Skip to main content
malfieri9
Associate
March 5, 2009
Question

Calling bootloader functions from user application

  • March 5, 2009
  • 15 replies
  • 3240 views
Posted on March 05, 2009 at 06:25

Calling bootloader functions from user application

    This topic has been closed for replies.

    15 replies

    jaroslaw2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    Hi,

    I was thinking about it and this is rather difficult. What you have to do is to modify your linker script, add additional section to the linker script and then place attribute next each function from bootloader. You have to create one project with bootloader and main application. This let you call functions.

    The only reading I have found is from Keil,

    http://www.keil.com/support/man/docs/armlink/armlink_ccheecgi.htm

    Maybe the IAR support could also help??

    I didn't have a time to test it, please let me know if you have something in this topic? I will have to do it eventually.

    malfieri9
    malfieri9Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    Does anybody know how to do this?

    I'm using IAR wotkbench (5.11)

    Thanks for any help

    jaroslaw2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    No, I proposed different way. Not to place objects in a specific addresses but rather separate functions.

    My idea is to create separate memory space

    MEMORY

    {

    RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K

    BOOT (rx) : ORIGIN = 0x8000000, LENGTH = 0x2000

    FLASH (rx) : ORIGIN = 0x8002000, LENGTH = 512K-0x2000

    FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

    EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0

    EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

    EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0

    EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0

    }

    Then if function belongs to bootloader you have to write.

    __attribute__((section(�BOOT�))) void BootFunction (vodi) {

    }

    Normal fucntion should be placed in FLASH reagion.

    malfieri9
    malfieri9Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    jaroslaw.oska thank you for your reply.

    The first thing i would think to need is to link the bootloader files into and object module (so all the initializations and startup are correclty managed by linker), and then include this in my application project. In this way the bootloader object module would be an absolute object, in ELF format.

    Is it right?

    But: how can i input the ILINK linker with an absolut object module so that it can be linked with relocatable objects of the application? is this possible?

    jaroslaw2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    In previous generations of arm's it used to be practised to place single functions in RAM to increase execution speed. Try to discover how they do it.

    jaroslaw2
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    Hi heavelove,

    Ok jump into RAM region, and then what??? Do you know how to place body of a function into RAM region.

    heavelove1
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    ==FYI:

    void (*pbootloaderEntry)(void) ;

    pbootloaderEntry=(void (*)(void)) (*((u32 *) 0x1ffff004));

    pbootloaderEntry();

    Maybe init MSP from 0x1ffff000(0x20000200) is need before jump.

    heavelove1
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    Dear jaroslaw.oska,

    ==The system bootloader in stm32f is start from 0x1FFF F000

    ==0x1FFF F000~0x1FFF F003 is the init msp value of BootLoader,usually 0x2000 0200.

    ==0x1FFF F004~0x1FFF F007 is the program start address of BootLoader.

    ==This region is flash, and not in RAM.

    ==If wish to place a function into RAM, you can use ''ramfunc'' in IAR.

    Regards!

    trevor1
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    Hi m.alfieri,

    Maybe this is a silly question but do you really need to do this? Are you that stuck for code space that you can't just include the functions you need in your application as well as in your bootloader?

    Calling functions in the bootloader from the app, as well as not being easy, leads to many computability issues and will be difficult to manage whn your product is rolled out. I guess you don't plan to change your bootloader once it is working (which is always the plan but never seems to work out like that) but if you did it would not be easy.

    I suspect you do have a good reason to do this so I guess I'm just curious what it is.

    Regards

    Trevor

    malfieri9
    malfieri9Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 12:56

    Thanks to all!

    I still misunderstand something, why are you talking about RAM?

    The starting problem was to link two different projects, perhaps the new tool (isymexport) released with IAR Workbench 5.40 could help?

    Regards