[SOLVED] How can I put 4 bytes at __FLASH_segment_end__ ?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] How can I put 4 bytes at __FLASH_segment_end__ ?

    Hi,
    How can I know what is the value of __FLASH_segment_end__ or FLASH used size in icf file? I want to put a variable right after it.
    Thank you very much.
    best regards,
    Morris
  • Hello Morris,

    Thank you for your inquiry.
    How generally the SEGGER Linker works is explained here:
    segger.com/doc/UM20005_Linker.html
    Flash and RAM sizes are either directly defined in the .icf file or in a MemoryMap.xml in your project or via project option memory segments.

    With SEGGER linker you can place symbols or sections at specific addresses directly as well without needing to reference the memory regions at all.

    What exactly are you planning to do?
    If you are looking to do integrity checks of your software e.g. with CRC, we recommend to do it as follows:
    wiki.segger.com/Integrity_chec…_Studio_and_SEGGER_Linker

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino,
    Thank you for the prompt response.
    What I want to do like "define region CRC = [end(FLASH)-4, size 4];" , but I want CRC address is right after the end of code, not the end of FLASH to save bin file size.
    Do you have any suggestion to achieve this?
    If you need more information, please let me know.
    Thank you very much.

    best regards,
    Morris
  • Hello Morris,

    you can place the CRC dynamically with section placement directives.
    segger.com/doc/UM20005_Linker.html#Section_placement_control

    In your case it would be
    place in FLASH {last section .YourCRCSectionName};


    Could you give this a try?


    Best regards,

    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello,

    Yes this behaviour is expected as the linker generated sections can only be placed after everything else is placed.
    So unfortunately "last section" placement will not work for your use case.
    What you could do is either place the CRC at a fixed location with:
    place at address 0x.... { section .APP_END };

    Or you would need to use an external tool that edits the bin/hex file and adds the CRC after the build is completed.

    If that tools supports command line arguments you can call it automatically in Embedded Studio via post build steps.

    Currently there is way to do this dynamically within Embedded Studio.


    Best regards,

    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.