Skip to main content
Zhang Lei
Associate II
October 25, 2017
Question

How to put a const array at 0x600 address

  • October 25, 2017
  • 7 replies
  • 1412 views
Posted on October 25, 2017 at 05:21

I want to put the boot_loader_version of 'const unsigned char boot_loader_version[3]={1,0,0};' at 0x600 of code flash, so the application can read it. How could I do it?

    This topic has been closed for replies.

    7 replies

    Erwan YVIN
    ST Technical Moderator
    October 26, 2017
    Posted on October 26, 2017 at 10:47

    Hello Zhang ,

    you shouldadd your sections in your linker files

    SECTIONS
    {
     . = ORIGIN(flash);
     .boot0 : ALIGN(16) SUBALIGN(16)
     {
     . += 0x00000000;
     KEEP(*(.boot))
     KEEP(*(.handlers))
     KEEP(*(.crt0))
     } > flash
     .boot1 : ALIGN(16) SUBALIGN(16)
     {
     /* The vectors table requires a 2kB alignment.*/
     . = ALIGN(0x800);
     KEEP(*(.vectors))
     /* The IVPR register requires a 4kB alignment.*/
     . = ALIGN(0x1000);
     __ivpr_base__ = .;
     KEEP(*(.ivors))
     } > flash
    �?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

    and

    __attribute__ ((section ('.bootloadersection'))) const unsigned char boot_loader_version[3]={1,0,0};�?

    you can try this ;)

    Best Regards

    Erwan

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    wang mengmeng
    Associate II
    June 12, 2018
    Posted on June 12, 2018 at 03:15

    Hello Erwan:

       I have the similar question,but the difference is  I want to put the function at the permanent address,so that I can jump to it from the application program? what should I do ?Thanks.

    Erwan YVIN
    ST Technical Moderator
    June 12, 2018
    Posted on June 12, 2018 at 08:56

    Hello Wang ,

    you should create a section located in 0x600 in user.ld.

    and use __attribute__ in the function prototype.

    There is a nice article about that

    https://www.silabs.com/community/mcu/32-bit/knowledge-base.entry.html/2016/03/07/using_a_linker_scrip-s5bu

     

         Best Regards

                            Erwan

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.