Skip to main content
henk2
Associate II
September 16, 2010
Question

How to define memory address for code storage?

  • September 16, 2010
  • 4 replies
  • 1462 views
Posted on September 16, 2010 at 10:06

How to define memory address for code storage?

    This topic has been closed for replies.

    4 replies

    henk2
    henk2Author
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:07

    Hi,

    >How is your bootloader going to start if it is at the top

    >of memory? The STM32 boots from address zero.

    You're right. I think using the System memory only to boot from and then jump to the bootloader application with it's own set of vectors.

    >but why don't you test with two separate applications

    I didn't think about this option but it seems a good idea to me!

    Henk

    stforum2
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 14:07

    Probably you can put the function into it's own named section and use the linker script to position the named section.

    How is your bootloader going to start if it is at the top of memory? The STM32 boots from address zero.

    Not sure if you can do this with your environment, but why don't you test with two separate applications, loading the bootloader and the application into flash one after the other?

    Andrew Neil
    Super User
    May 17, 2011
    Posted on May 17, 2011 at 14:07

    ... have you looked at the ST application notes that illustrate how to do In-Application Programming (IAP) - which involves having a bootloader to reprogram the flash...

    Try AN2557 first...
    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:07

    You should put the boot code at the front of the FLASH, and park the application code behind it.

    Depending on your toolset, you should be able to edit the options/setting which define the base address and size of the RAM and FLASH. You would configure those into subsets of the available space. You'll have to use the RAM, even if just for the stack. It will be hard for the C compiler not to use any RAM. To be honest if you want a small boot loader, it is best to code it in assembler where at least you have some control.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..