AN4370: Modifying the application linker file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN4370: Modifying the application linker file

Jump to solution
1,692 Views
vincentdin
Contributor I

Hello all,

I am working with a TWR-K20D50M and the software that goes along with AN4370.

I am using IAR for ARM v6.5, and am currently able to upload the dfu bootloader application to the board.  The microusb port can enumerate as a DFU device, and I can use the dfu_example.exe to flash the example k20 binary to the board.

When it comes to uploading a different binary, whether it be an MQX or bare metal application, I am unsure exactly what to modify in the linker application file.  I have tried fiddling with different values in a bare metal hello world example, but it is not generating a usable binary (it will upload with the dfu_example.exe, but it does not run properly).

In sections 4.1.3 and 4.2.2.3, it describes what needs to be changed for Kinetis boards.  It even shows a modified linker file, but in a code warrior context.

How would I translate this process to the IAR environment?  It is just different enough to where I am unable to generate a working binary.

Any help or tips would be greatly appreciated.  Thank you!

-Vincent

Labels (1)
1 Solution
754 Views
vincentdin
Contributor I

Hi DerekLau,

Thanks for your response.

I got it to work!

Here is what I did:

1) leave bootloader linker file unchanged

2) change application linker file as follows

     define symbol __ICFEDIT_intvec_start__ = 0x0000A000;

     define symbol __ICFEDIT_region_ROM_start__ = 0x0000A000;

     define symbol __code_start__ = 0x0000A410;

     define exported symbol __VECTOR_TABLE      = 0x0000A000;  //had to modify this line, too

I did try changing image address to 0x4000 along with the changes you suggested (for the bootloader application), but this caused problems with the dfu application (it would no longer enumerate as a DFU device).

-Vincent

View solution in original post

0 Kudos
2 Replies
754 Views
DerekLau
Contributor IV

The IMAGE_ADDR is defined as 0xA000 in the bootloader.h file.

Linker file can be modified as below:

define symbol __ICFEDIT_intvec_start__ = 0x0000A000;

define symbol __ICFEDIT_region_ROM_start__ = 0x0000A000;

define symbol __code_start__ = 0x0000A410;

The bootloader code actually does not occupy so large code size. You may change the IMAGE_ADDR to 0x4000 and change the linker file to.

define symbol __ICFEDIT_intvec_start__ = 0x00004000;

define symbol __ICFEDIT_region_ROM_start__ = 0x00004000;

define symbol __code_start__ = 0x00004410;

755 Views
vincentdin
Contributor I

Hi DerekLau,

Thanks for your response.

I got it to work!

Here is what I did:

1) leave bootloader linker file unchanged

2) change application linker file as follows

     define symbol __ICFEDIT_intvec_start__ = 0x0000A000;

     define symbol __ICFEDIT_region_ROM_start__ = 0x0000A000;

     define symbol __code_start__ = 0x0000A410;

     define exported symbol __VECTOR_TABLE      = 0x0000A000;  //had to modify this line, too

I did try changing image address to 0x4000 along with the changes you suggested (for the bootloader application), but this caused problems with the dfu application (it would no longer enumerate as a DFU device).

-Vincent

0 Kudos