exit status -1073741819 Error compiling for board Teensy 4.0.

greatjp

New member
Hello
I can't compile for teensy4.0.
If i try Arduino Uno, It succeed to build.
Tried on Arduino IDE.
Arduino 1.8.19 and Teensyduino 1.57

source code
Code:
int i;

void setup() {
  // put your setup code here, to run once:
  i=0;
}

void loop() {
  // put your main code here, to run repeatedly:
  i++;
}

Error Message
Code:
Linking everything together...
"D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-gcc" -O2 -Wl,--gc-sections,--relax "-TD:\\project\\arduino-1.8.19\\hardware\\teensy\\avr\\cores\\teensy4/imxrt1062.ld" -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/tet.ino.elf" "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163\\sketch\\tet.ino.cpp.o" "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/..\\arduino_cache_609626\\core\\core_d55592c3926a54c25b2d400de628ba7b.a" "-LC:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163" -larm_cortexM7lfsp_math -lm -lstdc++
"D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/tet.ino.elf" "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/tet.ino.eep"
"D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/tet.ino.elf" "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/tet.ino.hex"
"D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure" encrypthex TEENSY40 "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163/tet.ino.hex"
exit status -1073741819
Error compiling for board Teensy 4.0.

Thank you in advance.
 
Works on Windows 11 with IDE 1.8.19 and TeensyDuino 1.57

Used that code and the linking here shows:
Code:
[B]Linking everything together...
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-gcc" -O2 -Wl,--gc-sections,--relax "-TC:\\T_Drive\\arduino-1.8.19\\hardware\\teensy\\avr\\cores\\teensy4/imxrt1062.ld" -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf" "R:\\temp\\arduino_build_minSketch.ino\\sketch\\minSketch.ino.cpp.o" "R:\\temp\\arduino_build_minSketch.ino/..\\arduino_cache_minSketch.ino\\core\\core_602d4b6415879f50c27ce8e8ffefff4c.a" "-LR:\\temp\\arduino_build_minSketch.ino" -larm_cortexM7lfsp_math -lm -lstdc++
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.eep"
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.hex"
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure" encrypthex TEENSY40 "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.hex"
[/B]encrypting 10240 bytes to R:\temp\arduino_build_minSketch.ino/minSketch.ino.ehex
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_post_compile" -file=minSketch.ino "-path=R:\\temp\\arduino_build_minSketch.ino" "-tools=C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/" -board=TEENSY40
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/stdout_redirect" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.sym" "C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objdump" -t -C "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf"
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_size" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf"
teensy_size: Memory Usage on Teensy 4.0:

Bold part seems similar - seeming to have errored out on HEX encryption? Does the system have a key.pem file in the sketchbook folder? There is one here { of 3,196 bytes} and it has been used many times to work since that locking was in beta test.

When that file is renamed the build shows: No key .pem file found, skipping .ehex encryption

Does this teensy_secure.exe file exist there: "D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure"

Malware software here was deleting it to quarantine until they recognized it - perhaps there it is surviving but being kept from running?

Can you open a command window to that folder and run the program and see the console output?
 
I've seen similar problems in the past (intermittently, once every few months, where I'd get a seemingly random large numbered exit code) when compiling with CLion + PlatformIO and never quite figured out what causes it, possibly Windows Defender or other processes interfering with file access. A reboot usually sorted it out for me to release whatever locks were being held. In your case, @defragster's comment about teensy_secure.exe being quarantined seems like a pretty good guess.
 
Note: when it was deleted for 'my safety' there was then a build error indicating: the EXE not found.

This meant the eHex was not present when needed.
 
Does the system have a key.pem file in the sketchbook folder?
-> I can't find key.pem in my PC
-> where is sketchbook folder? Do you mean "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163" I can't find key.pem either.
Does this teensy_secure.exe file exist there: "D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure"
-> It's there
Code:
PS D:\project\arduino-1.8.19\hardware\tools> ls


    Directory: D:\project\arduino-1.8.19\hardware\tools


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         8/11/2022   8:08 PM                arm
d-----        12/20/2021   5:12 PM                avr
-a----         8/12/2022   6:02 PM          35696 mktinyfat.exe
-a----         8/12/2022   6:02 PM          28528 precompile_helper.exe
-a----         8/12/2022   6:02 PM          23408 stdout_redirect.exe
-a----         8/12/2022   6:02 PM        4483816 teensy.exe
-a----         8/12/2022   6:02 PM          26992 teensy_gateway.exe
-a----         8/12/2022   6:02 PM          55152 teensy_ports.exe
-a----         8/12/2022   6:02 PM          37232 teensy_post_compile.exe
-a----         8/12/2022   6:02 PM          58224 teensy_reboot.exe
-a----         8/12/2022   6:02 PM          23920 teensy_restart.exe
-a----         8/12/2022   6:02 PM        2131824 teensy_secure.exe
-a----         8/12/2022   6:02 PM          58224 teensy_serialmon.exe
-a----         8/12/2022   6:02 PM          80240 teensy_size.exe
-a----         8/12/2022   6:07 PM          86490 wheel.ino.hex


PS D:\project\arduino-1.8.19\hardware\tools> ./teensy_secure encrypthex TEENSY40 .\wheel.ino.hex
PS D:\project\arduino-1.8.19\hardware\tools>

Works on Windows 11 with IDE 1.8.19 and TeensyDuino 1.57

Used that code and the linking here shows:
Code:
[B]Linking everything together...
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-gcc" -O2 -Wl,--gc-sections,--relax "-TC:\\T_Drive\\arduino-1.8.19\\hardware\\teensy\\avr\\cores\\teensy4/imxrt1062.ld" -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf" "R:\\temp\\arduino_build_minSketch.ino\\sketch\\minSketch.ino.cpp.o" "R:\\temp\\arduino_build_minSketch.ino/..\\arduino_cache_minSketch.ino\\core\\core_602d4b6415879f50c27ce8e8ffefff4c.a" "-LR:\\temp\\arduino_build_minSketch.ino" -larm_cortexM7lfsp_math -lm -lstdc++
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.eep"
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.hex"
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure" encrypthex TEENSY40 "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.hex"
[/B]encrypting 10240 bytes to R:\temp\arduino_build_minSketch.ino/minSketch.ino.ehex
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_post_compile" -file=minSketch.ino "-path=R:\\temp\\arduino_build_minSketch.ino" "-tools=C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/" -board=TEENSY40
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/stdout_redirect" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.sym" "C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objdump" -t -C "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf"
"C:\\T_Drive\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_size" "R:\\temp\\arduino_build_minSketch.ino/minSketch.ino.elf"
teensy_size: Memory Usage on Teensy 4.0:

Bold part seems similar - seeming to have errored out on HEX encryption? Does the system have a key.pem file in the sketchbook folder? There is one here { of 3,196 bytes} and it has been used many times to work since that locking was in beta test.

When that file is renamed the build shows: No key .pem file found, skipping .ehex encryption

Does this teensy_secure.exe file exist there: "D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure"

Malware software here was deleting it to quarantine until they recognized it - perhaps there it is surviving but being kept from running?

Can you open a command window to that folder and run the program and see the console output?
 
Does the system have a key.pem file in the sketchbook folder?
-> I can't find key.pem in my PC
-> where is sketchbook folder? Do you mean "C:\\Users\\JINPYO~1.GWA\\AppData\\Local\\Temp\\arduino_build_414163" I can't find key.pem either.
Does this teensy_secure.exe file exist there: "D:\\project\\arduino-1.8.19\\hardware\\teensy/../tools/teensy_secure"
-> It's there
Code:
PS D:\project\arduino-1.8.19\hardware\tools> ls


    Directory: D:\project\arduino-1.8.19\hardware\tools


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         8/11/2022   8:08 PM                arm
d-----        12/20/2021   5:12 PM                avr
-a----         8/12/2022   6:02 PM          35696 mktinyfat.exe
-a----         8/12/2022   6:02 PM          28528 precompile_helper.exe
-a----         8/12/2022   6:02 PM          23408 stdout_redirect.exe
-a----         8/12/2022   6:02 PM        4483816 teensy.exe
-a----         8/12/2022   6:02 PM          26992 teensy_gateway.exe
-a----         8/12/2022   6:02 PM          55152 teensy_ports.exe
-a----         8/12/2022   6:02 PM          37232 teensy_post_compile.exe
-a----         8/12/2022   6:02 PM          58224 teensy_reboot.exe
-a----         8/12/2022   6:02 PM          23920 teensy_restart.exe
-a----         8/12/2022   6:02 PM        2131824 teensy_secure.exe
-a----         8/12/2022   6:02 PM          58224 teensy_serialmon.exe
-a----         8/12/2022   6:02 PM          80240 teensy_size.exe
-a----         8/12/2022   6:07 PM          86490 wheel.ino.hex


PS D:\project\arduino-1.8.19\hardware\tools> ./teensy_secure encrypthex TEENSY40 .\wheel.ino.hex
PS D:\project\arduino-1.8.19\hardware\tools>

If KEY.PEM was not created using the tools - there will not be one on the system. This is only used when an encrypted T_4.x is in use.

Also seems the local copy of teensy_secure.exe exists, but is not allowed to run to completion. WHen run here I gave NO cmdline parameters and it gave usage and copyright notes. Indications are execution was terminated by an 'outside influence'

Windows defender on my system is not interfering with that program AFAIK - but if another AntiVirus program may be installed and is interfering?

If the antivirus/malware cannot be given an exclusion for that file or folder or made to accept it, the perhaps a manual edit to Platform.txt would allow normal usage when encryption is not in use.
> file here is located at: ..\arduino-1.8.19\hardware\teensy\avr\platform.txt

I see two active lines calling that program in that txt file.
> close the IDE is in use

AFAIK this may work:: edit platform.txt to "##" comment those two lines:
Code:
## EHEX file - for Teensy 4.x secure mode
[B][COLOR="#FF0000"]## [/COLOR][/B]recipe.hooks.objcopy.postobjcopy.1.pattern="{teensytools.path}teensy_secure" encrypthex {build.board} "{build.path}/{build.project_name}.hex"
and line #114 here:
Code:
[B][COLOR="#FF0000"]##[/COLOR][/B] recipe.hooks.savehex.postsavehex.1.pattern="{teensytools.path}teensy_secure" encrypthex {build.board} "{sketch_path}/{build.project_name}.{build.board}.hex"

Open the IDE or build again. If it doesn't work those lines can have the comments removed, and that file is replaced when TeensyDuino is installed.
 
It work!
Thank you very much~.

AFAIK, encryption are for security, isn't it?
It's not commercial product, encryption are not necessary.

Thank you again.
 
It work!
Thank you very much~.

AFAIK, encryption are for security, isn't it?
It's not commercial product, encryption are not necessary.

Thank you again.

You are welcome, glad it worked - didn't test here - but that seemed the right fix.

Indeed for security, unless a special Encrypt-able Teensy is in use there is no need for that program. It allows the Teensy to store the code encrypted (new bootloader allows this even on normal recent production boards) so that 'reading' the Flash doesn't expose the stored HEX program. And on the encrypted versions allows them to be marked to ONLY run properly encrypted HEX.

Would be interesting if you had an idea what was keeping it from running the Teensy_Secure.exe. Is this WIndows 10 or 11? Any added AntiVirus or Malware software running?
 
OS: windows 10
AntiVirus: v3 internet security (Used in korea. I tried to stop malware check, But, I can't. It seem controlled by corporate policy. )
 
Thanks, not seeing easy way to make the EXE non executable to try to see if the error code comes back the same.

Web search on the error code gave:
> one: ref suggesting UAC
> another: The exit code -1073741819 in hex is 0xC0000005. If you look up this code in Microsoft's documentation (NTSTATUS Values) you will see that it indicates that your program was terminated due to an access violation. This error can occur for a variety of reasons, including de-referencing a NULL pointer or referencing an invalid address.

Assuming it isn't a simple NULL ptr or stack var overflow error as it would affect others as well (been using it here for months since it went Beta), it is likely the AntiVirus aborting the execution for some reason and triggering that error code.
 
Back
Top