GCC Linker script for FSL Bootloader

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

GCC Linker script for FSL Bootloader

1,773 Views
tipofthesowrd
Contributor I

Hello

I'm currently working on the FSL_Kinetis_Bootloader 1.1.0 and I'd like to use it in combination with my GCC compiled binary.

The flashing through the HID device and the supplied KinetusUpdater.exe works fine (albeit a little slow).

However since I'm using GCC the linker scripts for my application is quite different then IAR.

My memory regions are layed at to start the user application at address 0x8000 but this causes a HardFault.

However, it is my user application's HardFault handler so I know flashing has succeeded.

MEMORY

{

  VECTORS (rx) : ORIGIN = 0x00008000, LENGTH = 0x00000400

  FLASH_PROTECTION    (rx) : ORIGIN = 0x00008400, LENGTH = 0x00000010

  FLASH (rx) : ORIGIN = 0x00008410, LENGTH = 128K - 0x00008410

  RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 16K - 0xC0

}

I guess it has something to do with the Bootloader Configuration Area (BCA) but I can't seem to get any useful info from the supplied linker scripts.

Any help would be appreciated.

Tags (2)
0 Kudos
7 Replies

977 Views
tipofthesowrd
Contributor I

I was able to fix the problem. My CMSIS implementation was hard copying the interrupt table from 0x0000 to RAM instad of looking at the SCB->VTOR register.

0 Kudos

977 Views
jay_heng
NXP Employee
NXP Employee

Hi Tipoftheswrd,

  Have you ever tried your application directly without FSL bootloader? Is it running properly?

  BCA will not affect your application if you doesn't have a valid one in it.

PS: The first member of BCA is tag: 'kcfg', If FSL bootloader fails to check the valid tag then it will use default BCA.

Best Regards,

Jay

0 Kudos

977 Views
tipofthesowrd
Contributor I

Hi Jay

yes, my original application runs fine if I use the default linker script.

Does the startup code of the user program have to change? Because thes user program will run SystemInit() again to set clocks etc.

Thanks for the information about the BCA tag. This means its probably something simple in my linker script right?

Below is what I currently use for my user program. I'll try and add the binaries later today so Ping can check.

MEMORY

{

  VECTORS (rx) : ORIGIN = 0x00008000, LENGTH = 0x00000400

  FLASH_PROTECTION    (rx) : ORIGIN = 0x00008400, LENGTH = 0x00000010

  FLASH (rx) : ORIGIN = 0x00008410, LENGTH = 128K - 0x00008410

  RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 16K - 0xC0

}

Regards

Kevin

0 Kudos

977 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Tipoftheswrd,

I'd like to suggest that you can disable the SystemInit() function in the application project at first, then program the compiled binary to the MCU and check whether the MCU can work fine or not.

I'm looking forward to the testing result.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

977 Views
jay_heng
NXP Employee
NXP Employee

Hi kevin,

I don't think there is any source code change needed for user app, The only thing is to modify the linker file.

Seems your linker file is ok if FSL bootloader specifies the app base address to 0x8000, From the RAM section you defined, seems you wants to copy vector to ram right? you may need to debug into your app to locate the place where the hardfault happens.

Best Regards,

Jay

0 Kudos

977 Views
tipofthesowrd
Contributor I

I've made very little progress these last few days with this issue.

My guess is the startup code of my user program is not as it should be.

If I look in the led_demo example the IAR startup code has references to the Bootloader configuration area

However, there is no example for a user program with GNU GCC startup code?

Can somebody help adjusting the default GNU GCC startup code to include this Bootloader configuration area?

0 Kudos

977 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Tipoftheswrd,

I'd like to check with you about which MCU you use.

If it's Ok, you can share your application project, then I can reproduce your phenomenon on my board.

I'm looking forward to your reply.

Have a great day!

Ping

0 Kudos