ARM asm?

Status
Not open for further replies.

Citabria

Active member
Hi. First-time poster here.

Does Teensyduino C support the asm statement to embed ARM code for a Teensy3?

If not, can C code be written to compile to a very tight loop, say ~5 cycles? Example loop:
loop:
read entire port C into reg
compare reg with immediate value
branch to loop if not equal

Thanks.
 
I just tried it and it seems to work. I added __asm__("ldr r0,[r1]\n\t"); to the Blink example and it compiled.

Is there documentation somewhere about which registers are OK to modify and how to get register values into C variables, etc.?
 
Yes, but not in Arduino.

You can run arm-none-eabi-objdump -d file.elf to turn the .elf file into an assembly language listing. The arm-none-eabi-objdump program is in hardware/tools/arm-none-eabi/bin.
 
If you are running outside of the Arduino IDE, you can add the -save-temps option (or the newer -save-temps=obj which works better for some complex environments), and it will create .ii/.s files as part of the compilation (-save-temps drops the file in the current directory, -save-temps=obj drops the files in the output directory).
 
Maybe not so painless. I installed Teensyduino 1.16 over Arduino 1.0.5 on Mac OS X 10.6.8 and the Blink sketch works. I can modify it and download and run it but when I try the serial monitor I get this:

Arduino: 1.0.5 (Mac OS X), Board: "Teensy 3.0"
Binary sketch size: 18,400 bytes (of a 131,072 byte maximum)
Estimated memory use: 3,452 bytes (of a 16,384 byte maximum)
processing.app.SerialNotFoundException: Serial port '/dev/tty.usbserial-A50201WT' not found. Did you select the right one from the Tools > Serial Port menu?

Well, that port doesn't show up in that menu. Did I miss a step during installation?
 
Serial port '/dev/tty.usbserial-A50201WT' not found. Did you select the right one from the Tools > Serial Port menu?

That doesn't look like a serial port associated with Teensy. Normally on Macs they have names like /dev/cu.usbmodem12341. "usbserial-A50201WT" is very likely something else connected to your Mac.

Of course, the serial port only appears on your Mac *after* you upload and Teensy begins running the program you uploaded. Also, before you upload, Tools > USB Type needs to be set to "Serial". The others will create non-serial devices, which obviously won't show up as a serial port name.

The option "Serial+Keyboard+Mouse+Joystick" requires Mac OS-X 10.7 (Lion) or later. Sorry, it doesn't work on Snow Leopard. Apple simply didn't start supporting Serial+otherstuff devices until Lion. Microsoft also didn't support this until XP-SP3 and Vista-SP1, and there was a time long ago when Linux didn't support it (though Linux has supported it far longer and with fewer bugs than Apple or Microsoft).
 
Last edited:
Thanks again. I selected the port you mentioned and it works. The other port was left over from the Arduino Nano I had plugged in before.

Nice work on the Teensy BTW!
 
Status
Not open for further replies.
Back
Top