I use Atmel Studio to program the ATSAME70N21B. When I want to flash the compiled code direct (with Atmel-ICE) to the controller I have to use the standard linker script "flash.ld", located in:
But when I want to flash the code with our custom bootloader, I first have to change the memory space definitions in the linker script (flash.ld). This very annoying when I always have to edit this file in dependency of the flasher device. And I can't see, with which memory options the output hex file was compiled/linked.
So I wanted to do this:
1) In the Atmel Studio configuration manager add "Bootloader". So I could choose in the project properties between the default "Release", "Debug" and my "Bootloader". So the output files should have own folders.
2) Create two linker scripts: flash_debug.ld (= the original flash.ld) and flash_bootloader.ld (with other memory settings).
2.1) I renamed the flash.ld to flash_debug.ld. The original flash.ld is deleted.
3) In the project properties use the flash_default at configuration Release/Debug and use the flash_bootloader.ld at configuration Bootloader.
3.1) I changed Properties->Toolchain->ARM/GNU Linker->Miscellanous->Linker Flags to:
-Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam/utils/linker_scripts/same70/same70n21/gcc/flash_debug.ld
But when I compile, it aborts with "Build Failed"... In the output I found this line:
make: *** No rule to make target '../src/ASF/sam/utils/linker_scripts/same70/same70n21/gcc/flash.ld', needed by 'MLS_LightSlave_S4P2e_S12P4e.elf'. Stop.
So Atmel Studio it tried to use the old linker script and not the renamed I set at 3.1).
I looked into the auto generated makefile of Atmel Studio and found the line:
I can't change this line because Atmel Studio restores it at every compile process. But I find no option to change the makefile generation in Atmel Studio, so it uses my desired linker script...
Can somebody help me?