Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Is there a way to use different linker files (imxrt1062_t41.ld and someOther.ld) based on different (Read 1436 times)
HK
Newbies
*
Offline


Posts: 2
Joined: Mar 5th, 2024
Is there a way to use different linker files (imxrt1062_t41.ld and someOther.ld) based on different
Mar 6th, 2024 at 10:33am
Print Post  
Hello Everyone, 

This is my forst post.... 
We are creating a project based on Teensy 4.1 and using visual micro as our development platform.

It so happens that we are in need to create a tiny bootloader that verifies the integrity of application before jumping.

We did changes to linker file and got the proof of concept working. 

But now I am in a situation where I want to use modified linker file to build application if it is meant for bootloader (Lets call it release_for_bootloader).
Otherwise for my development and debugging purposes I want to use the original loader (Lets call it debug).

The way I have been able to use my custom linker file is to create a Board.txt and then compile.

My board.txt looks like


Code
Select All
build.flags.ld=-Wl,--gc-sections,--relax "-T{build.core.path}/myCustomLinker.ld"
" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}``
 



The issue that I am facing is that, the "Board.txt" is used in all project configurations.

Is there any workaround or any other ideas that could work.

Thanks for reading
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Is there a way to use different linker files (imxrt1062_t41.ld and someOther.ld) based on different
Reply #1 - Mar 6th, 2024 at 12:23pm
Print Post  
Thanks for the report.

One option would be to include the Build Configuration name in the bootloader file name (Debug/Release etc), so they could then be referenced with the {vm.solution.configuration_name} merge field in the pattern you have above.

Code
Select All
# Example: Use the Solution Build Configuration Name in the LD File name to merge (resulting in myCustomLinker_Debug.ld and myCustomLinker_Release.ld)
build.flags.ld=-Wl,--gc-sections,--relax "-T{build.core.path}/myCustomLinker_{vm.solution.configuration_name}.ld" " {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}
 

  
Back to top
IP Logged
 
HK
Newbies
*
Offline


Posts: 2
Joined: Mar 5th, 2024
Re: Is there a way to use different linker files (imxrt1062_t41.ld and someOther.ld) based on different
Reply #2 - Mar 6th, 2024 at 4:42pm
Print Post  
Thanks Simon.

That's a very good idea... Will try it
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint