Filename or extension too long - Arduino Nano 33 IoT

Hi,

I am trying to compile a deployment script that I previously built for the Arduino Nano 33 BLE to find out whether it is feasible to run this on the Arduino Nano 33 IoT. After a few minor changes to the code, I am stuck with the following error:

fork/exec C:\Users\MYUSER\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++.exe: The filename or extension is too long.

Now, I am familiar with this error, as it occurred for the Arduino Nano 33 BLE as well, but this was simply fixed after downloading the platform.local.txt file and copying it under the mbed directory.
However, I only found this fix for mbed and ESP32 boards. Is there a similar fix for SAMD21-based boards like the Arduino Nano 33 IoT?

PS: I tried compiling the same code in the Arduino IDE on Linux and I got no errors, so everything else seems to work fine.

Hey, yeah, this is a Windows-only error. We’ve reported it to the Arduino team, but no fix in the tools yet. @aurel might have an idea on what to change for the platform.local.txt for the SAMD21.

Hi @dvanderlans,

It should work with the following platform.local.txt (put under samd directory):

## Customized platform.local.txt to compile for SAMD21 targets under Windows
## This recipe works around the Windows limit of 32k characters in a cmd line by calling .o files from a text file during linking
## Install: put file under your mbed sub-directory - ie: C:\Users\MYUSER\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.9
## You can also find the local arduino folder in the IDE under File -> Preferences -> see preferences.txt location in the bottom part of the window

## hooks

# create a txt file with all object file paths from libraries and sketch folders (core\variant.cpp.o needed too for linking)
recipe.hooks.linking.prelink.1.pattern=cmd /c dir /b /s {build.path}\sketch\*.o > {build.path}\obj_files_tmp.txt
recipe.hooks.linking.prelink.2.pattern=cmd /c "dir /b /s {build.path}\libraries\*.o >> {build.path}\obj_files_tmp.txt 2>nul & exit 0"
recipe.hooks.linking.prelink.3.pattern=cmd /c echo "{build.path}\core\variant.cpp.o" >> {build.path}\obj_files_tmp.txt

# replace \ by \\ in file paths (otherwise escaped by linker) and save in new txt file
recipe.hooks.linking.prelink.4.pattern=cmd /v /c "@echo off && for /f %a in ({build.path}\obj_files_tmp.txt) do (set line=%a && set line=!line:\=\\! && echo !line! >> {build.path}\obj_files.txt)"

# delete txt file after linking
recipe.hooks.linking.postlink.1.pattern=cmd /c del {build.path}\obj_files.txt


## modify compile patterns (@{build.path}\obj_files.txt)
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}"  "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" @{build.path}\obj_files.txt {compiler.libraries.ldflags} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" -Wl,--end-group

I will update our documentation.

Cheers,
Aurelien

Thanks for this fix.

Will this also work for SAMD51 and Teensy boards?

Thanks again.

If you use an Adafruit SAMD51 board, there is a minor change on this last line compared to the code above:

recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}"  "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" @{build.path}\obj_files.txt {compiler.libraries.ldflags} -Wl,--start-group {compiler.arm.cmsis.ldflags} "-L{build.variant.path}" -lm "{build.path}/{archive_file}" -Wl,--end-group

For Teensy, do you use TeensyDuino or a different tool?

Aurelien

aurel –

Thanks for your prompt reply; I’ll make that change for SAMD51.

For Teensy I am using TeensyDunio.

Thanks again.

Thanks for the quick response. This fixed the issue!

Daan

1 Like

I’m having the same issue using the Wio Terminal which uses a different SAMD51 than Adafruit. The platform.txt file is located at …\Arduino15\packages\Seeeduino\hardware\samd\1.8.1. Will the platform.local.txt file that you have for the Adafruit SAMD51 work for the Wio Terminal? Not sure why it would be specific to Adafruit.

Thanks,
Ralph

cc @aureleq, but this issue is fixed according to Arduino if you switch to a nightly version of the IDE (and will be released in v0.14 of the CLI), see here.

Hi @ralphjy,

This will work with the Adafruit one, they use exactly the same compiling options.

Aurelien

Thanks. I’ll get around to trying an update to the IDE (I’m using 1.8.13), but for now just adding the platform.local.txt for the Adafruit SAMD51 worked.

1 Like