This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

const at fixed address

I have a Tiva TM4C123AH6 with CCS 5

I need to write some data information at fixed address in flash.

 const char Driver [19]=  "ABCDEF1000V0\030\003\040\021\025\125";

How can I force this string at address  0x0100.1000 ?


Thanks

  • Hi,

    If I am not wrong, the address 0x0100.1000 may be inside TI's ROM area, where the boot loader and driverlib resides - if that is the case, you have no chance since this is ROM, not FLASH.

    If you still need to place something at absolute address, then declare a section in source file and place that string/array there, and then in linker file declare the section placed at the wanted absolute address. 

    Petrei

  • Yes sorry, my address example is wrong, the flas address space start from 0x0000.00000

    I need to place a string at absolute address; can you write a example

  • Hi,

    First step is to read the compiler manual - look for #pragma for declaring sections and then the linker chapter.

    Search also the forum, including that for compiler, for same subject.

    I will prepare an example later (although I think I already posted one here)

    Petrei

  • Another approach here is to use a spare interrupt vector to point to the memory that hold the information.  This frees you from having to predict the required space to reserve for future uses. 

     

    Robert

  • Always love it when a, "need is declared" w/out one iota of such, "need's" justification...

  • The justification is write in code the sw and data version.

    This code can be read by serial command that read the code at adress xxxyyy.

    The reason to write a version at fixed address is because the external command read only at fixed addresses

     

  • Hi,

    Add this to your source file:

    #pragma DATA_SECTION(myvar, ".secret")
    const uint8_t myvar[] = "0123456789ABCDEFGHIJ";

    And modify the .cmd file as below (example):


    SECTIONS
    {
    .intvecs: > APP_BASE
    .text : > FLASH
    .const : > FLASH
    .cinit : > FLASH
    .pinit : > FLASH
    .init_array : > FLASH
    .secret: > APP_BASE+0x0001F000

    .vtable : > RAM_BASE
    .data : > SRAM
    .bss : > SRAM
    .sysmem : > SRAM
    .stack : > SRAM
    }

    Petrei

  • Stefano De Blasiis said:

    The justification is write in code the sw and data version.

    This code can be read by serial command that read the code at adress xxxyyy.

    The reason to write a version at fixed address is because the external command read only at fixed addresses

     
    That's a design decision that will cause adverse effects throughout your code.
     
    Robert
  • I do not understand what negative effects can occur if an code area has fixed values ​​of the absolute ... ??
    Anyway I've write the code and it seems to work.
     
    Thanks all !!
     
    :-)
  • Stefano De Blasiis said:
    Anyway I've write the code and it seems to work

    Very good

    Stefano De Blasiis said:
    I do not understand what negative effects can occur if an code area has fixed values ​​of the absolute

    That has negative effects too.  You have now commited to manually managing memory.  That is at least a self contained issue.

    I was, however, referring to your communications protocol which uses the processor address in its queries (and by extension probably its sets as well).

    Robert