Teensy - where/how to compile?

BitSeeker

New member
I have been trying to compile a project for a Teensy 4.1 board. I come from an Arduino background and my project compiles and works fine on an Arduino AVR oard such as a Meg2560 or Uno.

When I try to compile for the Teensy 4.1, I get an assembler error:

Code:
In file included from /home/johnc/.arduino15/packages/teensy/hardware/avr/1.59.0/cores/teensy4/WProgram.h:42,
                 from /home/johnc/.cache/arduino/sketches/6FA89962C18D654F5053107F19C89439/pch/Arduino.h:6:
/mnt/ntfs/Data/Data/Programming/Arduino/AR488/Git/AR488/src/AR488/AR488.ino: In function 'void printPin(const __FlashStringHelper*, uint8_t)':
/mnt/ntfs/Data/Data/Programming/Arduino/AR488/Git/AR488/src/AR488/AR488.ino:2278:39: warning: 'section' attribute does not apply to types [-Wattributes]
 2278 |   strcpy_P(pname, (const char PROGMEM *)pinid);
      |                                       ^
/home/johnc/.arduino15/packages/teensy/hardware/avr/1.59.0/cores/teensy4/avr/pgmspace.h:60:45: note: in definition of macro 'strcpy_P'
   60 | #define strcpy_P(dest, src) strcpy((dest), (src))
      |                                             ^~~
/tmp/ccg6UN1j.s: Assembler messages:
/tmp/ccg6UN1j.s:37: Error: bad instruction `jmp 0'
/tmp/ccg6UN1j.s:16297: Error: bad instruction `jmp 0'
/tmp/ccg6UN1j.s:17265: Error: bad instruction `jmp 0'
/tmp/ccg6UN1j.s:17336: Error: bad instruction `jmp 0'
exit status 1

Compilation error: exit status 1

I also tried compiling in VsCode with PlatformIO. This resulted in the following message:

Code:
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (5.0.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy @ 1.159.0 (1.59)
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Error: This board doesn't support Arduino framework!
========================== [FAILED] Took 0.28 seconds ==========================

Environment    Status    Duration
-------------  --------  ------------
teensy         FAILED    00:00:00.281
==================== 1 failed, 0 succeeded in 00:00:00.281 ====================

These Teensy boards cannot be programmed in either of these environments?
If so, then how can I program the Teensy 4.1, and why do the example programs work in Arduino IDE2.3.6?

The guys on the Arduino forum suggested I contact this forum for further advice.

BTW, is there a dark mode for this forum? The bright colours are hard on the eyes.
 
Please show us your code/program. Perhaps you are using code specific to Arduino boards.
I assure you that the Teensy family can be programmed in the Arduino environment.
 
After some hours I managed to solve the problem on the Arduino IDE (v2.3.6) and can now get my project to compile there. However, I still can't get the corrected version of my code to compile on Vscode. This is y Platformio.ini:

Code:
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:uno]
platform = atmelavr
board = uno
framework = arduino

[env:teensy]
platform = teensy
board = teensy41
framework = Arduino

I still get the same output as above. I have added forward declarations to main.cpp to remove any error dues to missing references.
Can Teensy boards e programmed on Vscodev using the Arduino framework, or do they need a Teensy framework?
 
Back
Top