element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Forum Configuring the Vector Table offset when using the Kinetis Bootloader and KDS
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freedom development platform to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 2 replies
  • Subscribers 6 subscribers
  • Views 935 views
  • Users 0 members are here
  • gcc
  • freescale
  • bootloader
  • freedom
Related

Configuring the Vector Table offset when using the Kinetis Bootloader and KDS

Former Member
Former Member over 10 years ago

I'm currently working on setting up the Kinetis Bootloader for the FRDM board, in order to use it as a system for wireless OTA updates.  Seeing as the bootloader lives in the flash memory, the standard way to keep the bootloader reusable is to write your program to the flash memory starting at an address after the bootloader code.  The example that comes with the Kinetis Bootloader code is a blinky program that is supposed to be written starting at address 0xA000.

 

However, I can't figure out how to set up the offset in my own code so that it works correctly when written at an adress other than 0x0000. I'm using the Kinetis Development Studio with gcc, does anyone else have experience making their own user app at a custom offset into the program?

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    0 Former Member over 10 years ago

    Okay, so when using the Processor Expert configuration menu, it allows you to change the address and size of both interrupts and text to whatever location you want.

    HOWEVER: Processor expert also generates another section in the linker file, m_flash_config, which defaults to the address of 0x000400.  So if this isn't changed as well, you get a file with a KB of empty data, 16 bytes of flash configuration data, and then empty data until your program's address.  This obviously doesn't work and makes debuggers cry.

    So, if I wanted to change the offset from 0x0000 (the default), to 0xA000 (the default with a bootloader), the solution is to open the ProcessorExpert.ld linker file in your Project_Settings file, and change the memory section from this:

    MEMORY {
      m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
      m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0
      m_interrupts_ram      (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00000400
      m_data_1FFF0400       (RW)  : ORIGIN = 0x1FFF0400, LENGTH = 0x0000FC00
      m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00030000
      m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
    }

     

    To this:

    MEMORY {
      m_interrupts          (RX)  : ORIGIN = 0x0000A000, LENGTH = 0x00000400
      m_text                (RX)  : ORIGIN = 0x0000A410, LENGTH = 0x000F5BF0
      m_interrupts_ram      (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00000400
      m_data_1FFF0400       (RW)  : ORIGIN = 0x1FFF0400, LENGTH = 0x0000FC00
      m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00030000
      m_flash_config        (RX)  : ORIGIN = 0x0000A400, LENGTH = 0x00000010
    }

    (note that m_text's size had to be reduced by the size of the offset, as to not overwrite m_interrupts_ram)

    (note also that this .ld file will be overwritten each time you generate files via processor expert)

     

    After that, loading the modified version via bootloader into memory at offset 0xA000 should work as usual!

     

    Good luck!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hello,

    Do it works for you?

    I've tried with a K22F and it's doesn't work fine...

    There are a modification in the startup.s code of the appli you want to boot. We have to configurate "The Bootloader Configuration Area (BCA) must be placed at 0x3C0 from the beginning of the image." Do you know how do this?

     

     

    BR

    Rémi

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hello,

    Do it works for you?

    I've tried with a K22F and it's doesn't work fine...

    There are a modification in the startup.s code of the appli you want to boot. We have to configurate "The Bootloader Configuration Area (BCA) must be placed at 0x3C0 from the beginning of the image." Do you know how do this?

     

     

    BR

    Rémi

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube