Pages: 1 2 [3] 4 5 ... 7   Go Down
Author Topic: The VideoBlaster Hi Resolution TVout platform  (Read 6481 times)
0 Members and 1 Guest are viewing this topic.
Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1429
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Not in the Arduino IDE it isn't.

I really do not see the distinction being made here...
if one follows the work done in the USB keyboard project for V-USB, the assembly code is inline in an external <foo>.S file which is pulled in through inclusion in a <foo>.asm file which is pulled in by inclusion in a <foo1>.C file which is referenced through extern "C"{ in a standard header file for Arduino.  It's just a chained library, and the Arduino 1.0.5 environment is compiling the assembler automatically through the Arduino GUI.  The fact that it must be inline in an external library is not of significance, IMO.

I did not say it was easy, I said it was do-able.

Here is a note from rancidbacon in a notes file:
Quote
* Versions of the Arduino IDE prior to 0018 won't compile our library
  so it needs to be pre-compiled with:

    avr-g++  -Wall -Os -I. -DF_CPU=16000000 -mmcu=atmega168  -c usbdrvasm.S  -c usbdrv.c

Ray

Reference this line below: C:\Users\owner\Documents\Arduino\libraries\UsbKeyboard\usbdrvasm.S -oC:\Users\owner\AppData\Local\Temp\build7593064582256327132.tmp\UsbKeyboard\usbdrvasm.S.o

Successful compile:
Code:
C:\Program Files\Arduino_105\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Program Files\Arduino_105\hardware\arduino\cores\arduino -IC:\Program Files\Arduino_105\hardware\arduino\variants\standard -IC:\Users\owner\Documents\Arduino\libraries\UsbKeyboard C:\Users\owner\AppData\Local\Temp\build7593064582256327132.tmp\USB_HID_AnalogX6_D8.cpp -o C:\Users\owner\AppData\Local\Temp\build7593064582256327132.tmp\USB_HID_AnalogX6_D8.cpp.o
In file included from USB_HID_AnalogX6_D8.ino:8:

C:\Program Files\Arduino_105\hardware\tools\avr\bin\avr-gcc -c -g -assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -DUSB_VID=null -DUSB_PID=null -IC:\Program Files\Arduino_105\hardware\arduino\cores\arduino -IC:\Program Files\Arduino_105\hardware\arduino\variants\standard -IC:\Users\owner\Documents\Arduino\libraries\UsbKeyboard -IC:\Users\owner\Documents\Arduino\libraries\UsbKeyboard\utility C:\Users\owner\Documents\Arduino\libraries\UsbKeyboard\usbdrvasm.S -oC:\Users\owner\AppData\Local\Temp\build7593064582256327132.tmp\UsbKeyboard\usbdrvasm.S.o
...
STUFF TOO LONG TO SHOW
...
C:\Users\owner\AppData\Local\Temp\build7593064582256327132.tmp\USB_HID_AnalogX6_D8.cpp.elf C:\Users\owner\AppData\Local\Temp\build7593064582256327132.tmp\USB_HID_AnalogX6_D8.cpp.hex
Binary sketch size: 8,284 bytes (of a 30,720 byte maximum)
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 350
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand you but the Arduino IDE doesnt work with S files without modification.

And to ask people to modify the IDE or the code wont compile is asking to much.
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1429
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I understand you but the Arduino IDE doesnt work with S files without modification.

And to ask people to modify the IDE or the code wont compile is asking to much.

Are you even looking at the output from the compiler which was done under 1.0.5 GUI?  It clearly shows that the unmodified installation is clearly picking up and compiling and linking he <foo>.S file.
IT WORKS UNMODIFIED.

Ray
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 350
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And how many are using IDE 1.0.5?

I am but just because I have a Due also.

People arent using that high versions of the Arduino IDE.
 
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 350
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My plan is to make an Arduino compatible board and add a composite video out, a ps2 connector for keyboard and mouse and SD/Micro-SD adapter.

All shield pins as the Uno.
And onboard IDE/compiler.

But I will use an ATmega644 and Clock it at 32MHz.

This means you can boot and develop with it without a PC.
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1429
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And how many are using IDE 1.0.5?
I am but just because I have a Due also.
People arent using that high versions of the Arduino IDE.

You do not want to acknowledge inline works, fine.  The facts as presented by rancidbacon indicate that GUI version * Versions of the Arduino IDE prior to 0018 won't compile our library but I can attest to versions 1.0.1, 1.0.3, and 1.0.5 working as described.  Anyone below 0018 probably is not wanting forum support.

I do not understand your attitude, but it is your project and you can do what the heck you want - my post was only to disprove the false reasoning that Arduino GUI had to be modified to compile inline assembler - it does not.  The workaround is to put the assembler in an <extern>.S file and follow the process used by rancidbacon in the link I provided earlier.


Ray
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4552
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you even looking at the output from the compiler which was done under 1.0.5 GUI?  It clearly shows that the unmodified installation is clearly picking up and compiling and linking he <foo>.S file.
IT WORKS UNMODIFIED.

Yep, it seems to work.

I haven't figured out the mechanism yet and the .S file isn't explicitly included anywhere that I can see. The IDE must be doing some magic, it adds "-assembler-with-cpp" to the compile line for that file.
Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4552
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just been playing and I figured out how to use .S files directly from the IDE. It can be done, but only inside a library (which means you have to use an external editor to edit the files).

Below is the most minimal example I could make, it's the blink sketch with some assembly code...  smiley

Extract the zip file into your 'libraries' folder then open "libraries->asm_test->blink".


* asm_test.zip (1.33 KB - downloaded 15 times.)
Logged

No, I don't answer questions sent in private messages...

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1429
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I've just been playing and I figured out how to use .S files directly from the IDE. It can be done, but only inside a library (which means you have to use an external editor to edit the files).

smiley-grin  There is a fungus among us!   smiley-grin
Thanks for the validation.  I suspect most members would prefer to use their own editor to edit assembly files, anyway.


Ray

PS: You should post this in the Exhibition / Gallery
Edit: I only knew it was possible because I use V-USB often and was aware of the foo.S implementation.  I do not know if rancidbacon was lead to this implementation, figured it out, or both... but it seems to be knowledge not widely known.

Super-Dupper BIG edit - check out
http://ucexperiment.wordpress.com/2013/05/31/arduino-blink-using-gcc-inline-assembly/
Code:

void setup() {
  asm volatile (
    "sbi %0, %1 \n\t"           //pinMode(13, OUTPUT);
    :: "I" (_SFR_IO_ADDR(DDRB)), "I" (DDB5)
  );
}
 
void loop() {
  asm volatile (
     "sbi %0, %1 \n\t"          //LED on
     "call OneSecondDelay \n\t" //delay
     "cbi %0, %1 \n\t"          //LED off
     "call OneSecondDelay \n\t" //delay
     "rjmp 4f \n\t"             //exit
 
  "OneSecondDelay: \n\t"
     "ldi r18, 0 \n\t"          //delay 1 second
     "ldi r20, 0 \n\t"
     "ldi r21, 0 \n\t"
 
  "1: ldi r24, lo8(400) \n\t"
     "ldi r25, hi8(400) \n\t"
  "2: sbiw r24, 1 \n\t"         //10x around this loop = 1ms
     "brne 2b \n\t"
     "inc r18 \n\t"
     "cpi r18, 10 \n\t"
     "brne 1b \n\t"
 
     "subi r20, 0xff \n\t"      //1000 x 1ms = 1 second
     "sbci r21, 0xff \n\t"
     "ldi r24, hi8(1000) \n\t"
     "cpi r20, lo8(1000) \n\t"
     "cpc r21, r24 \n\t"
     "breq 3f \n\t"
 
     "ldi r18, 0 \n\t"
     "rjmp 1b \n\t"
 
  "3: \n\t"
     "ret \n\t"
 
  "4: \n\t"                     //exit
 
     :: "I" (_SFR_IO_ADDR(PORTB)), "I" (PORTB5)
     : "r18", "r20", "r21", "r24", "r25"
  );
}

GCC ref: http://www.nongnu.org/avr-libc/user-manual/inline_asm.html
« Last Edit: November 26, 2013, 09:58:57 am by mrburnette » Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 350
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just been playing and I figured out how to use .S files directly from the IDE. It can be done, but only inside a library (which means you have to use an external editor to edit the files).

Below is the most minimal example I could make, it's the blink sketch with some assembly code...  smiley

Extract the zip file into your 'libraries' folder then open "libraries->asm_test->blink".



Thanks, I like that one.
If you want to use it as a funtion or pass parameters, how do you do that?

And, I'm sorry, mrburnette, I just plain did not know.
No hard feelings, I do now and stand corrected smiley
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1429
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
No hard feelings, I do now and stand corrected smiley

Of course, not.  We are all here to share experiences in a collective environment and to learn from others that have stumbled before us  smiley-grin


Ray
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4552
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just been playing and I figured out how to use .S files directly from the IDE. It can be done, but only inside a library (which means you have to use an external editor to edit the files).

Below is the most minimal example I could make, it's the blink sketch with some assembly code...  smiley

Extract the zip file into your 'libraries' folder then open "libraries->asm_test->blink".



Thanks, I like that one.
If you want to use it as a funtion or pass parameters, how do you do that?

I haven't figured that out yet. I'll have another play later....
Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4552
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PS: You should post this in the Exhibition / Gallery

I will when I've figured out more detail, eg. How to pass parameters to the function, how to return values to the caller, if there's a nice header file out there with hardware register names, etc.

I only knew it was possible because I use V-USB often and was aware of the foo.S implementation.  I do not know if rancidbacon was lead to this implementation, figured it out, or both... but it seems to be knowledge not widely known.

I've never seen it done so I assumed the IDE was against it (obviously you can do it at command-line level...)

It's a shame you can't just drop .S files in the IDE and use them. According to various sites you only need to change two lines of code to make that work.
Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4552
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This document has info on passing parameters, etc.

http://www.atmel.com/images/doc42055.pdf

Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4552
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've done a bit more investigating. The version below passes parameters to assembly language, accesses global variables and has a header file with port mappings.


* asm_test.zip (2.01 KB - downloaded 20 times.)
Logged

No, I don't answer questions sent in private messages...

Pages: 1 2 [3] 4 5 ... 7   Go Up
Jump to: