none
Is it possible to use parameters from config.bib in the code? RRS feed

  • Question

  • I am planning to modify startup.s to do some useful work before starting the initialization phase. I need to use some parameters from config.bib (like ROMSIZE=0x07000000). Is there a way to write something like ldr r0, =ROMSIZE instead of using hardcoded values like ldr r0, =0x07000000 in your code? So user later will not have to modify assembly code.
    • Edited by Jker Thursday, October 27, 2011 10:38 AM
    Thursday, October 27, 2011 10:37 AM

Answers

  • Here is another alternative, declare a public variable and fix it up in ROMIMAGE (config.bib) so you can change both side at once.
    in your ASM code have the following statements

        ldr     r0, ROM_SIZE
    
        EXPORT ROM_SIZE[DATA]
    ROM_SIZE
        DCD      0
    




    And in your config.bib

    CONFIG
        ROMSIZE   $(ROMSIZE_YOUWANT)
    
    MEMORY
       nk.exe:ROM_SIZE               00000000 $(ROMSIZE_YOUWANT)       FIXUPVAR
    



     


    • Edited by K M O S Thursday, October 27, 2011 8:06 PM
    • Proposed as answer by Bruce EitmanModerator Thursday, October 27, 2011 8:07 PM
    • Marked as answer by Jker Friday, October 28, 2011 11:01 AM
    Thursday, October 27, 2011 7:22 PM

All replies

  • You could use some define variables to select different ROMSIZE in your config.bib and startup.s files. So customer could select one of the configuration and the code could apply this configuration.

    Best regards,

    Mike


    Digi International Inc http://www.digi.com
    Thursday, October 27, 2011 10:41 AM
  • Here is another alternative, declare a public variable and fix it up in ROMIMAGE (config.bib) so you can change both side at once.
    in your ASM code have the following statements

        ldr     r0, ROM_SIZE
    
        EXPORT ROM_SIZE[DATA]
    ROM_SIZE
        DCD      0
    




    And in your config.bib

    CONFIG
        ROMSIZE   $(ROMSIZE_YOUWANT)
    
    MEMORY
       nk.exe:ROM_SIZE               00000000 $(ROMSIZE_YOUWANT)       FIXUPVAR
    



     


    • Edited by K M O S Thursday, October 27, 2011 8:06 PM
    • Proposed as answer by Bruce EitmanModerator Thursday, October 27, 2011 8:07 PM
    • Marked as answer by Jker Friday, October 28, 2011 11:01 AM
    Thursday, October 27, 2011 7:22 PM