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.

How to do changes in library rtssrc.zip?

I am working on Cortex M0. CCS under usage is 5.3.0.00090 & library is rtsv6M0_T_le_eabi.lib.

I want to configure one hardware register before/after initialization of RAM (before CPU reaches to main)
Initialization of RAM is performed through TI Library rtssrc.zip

Am I supposed to modify code available in rtssrc.zip or is there any other way (without modifying
rtssrc.zip) to perform requested operation? Please let me know its procedure.

Thanks & Regards,
Tushar

  • Tushar Barhate1 said:
    I want to configure one hardware register before/after initialization of RAM (before CPU reaches to main)
    Initialization of RAM is performed through TI Library rtssrc.zip

    With the MSP430 rtssrc.zip you could do this by adding a _system_pre_init function to your project, which replaced the stub in the rtcsrc.zip. Where _system_pre_init got called before the C RAM initialisation was performed.

    Looking at the ARM rtssrc.zip I can't see an equivalent option.

  • Tushar Barhate1 said:
    Am I supposed to modify code available in rtssrc.zip or is there any other way (without modifying
    rtssrc.zip) to perform requested operation? Please let me know its procedure.

    Another suggestion to consider ... Take boot.c from rtssrc.zip, modify it to suit your needs, then make it yet another source file in your system, right next to all your other source files.

    Thanks and regards,

    -George

  • Thanks for your reply.
    In M0 rtssrc.zip, boot.asm file is present. Now I want to modify memory location 0x40000530  with value 0xAA.
    I got assembly equivalent for (*((volatile unsigned char *)0x40000530)) = 0xAA as

    LDR             R1,$C$CON1
    MOVS          R0, #0xAA
    STRB           R0, [R1]

    I have added above instructions in boot.asm & assembler doesn't know $C$CON1 so giving compilation error.
    I don't have time to invest on assembly programming.

    Can you provide quick solution for the same?(if possible). 
    Please note: Above instructions will be added before RAM gets initialized i.e. before "BL __TI_auto_init" instruction.

    Thanks,
    Tushar

     



    Thanks,
    Tushar

     


     

     

  • I presume

    Tushar Barhate1 said:
    LDR             R1,$C$CON1

    comes from compiler generated assembly.  The $C$CON1 is a label for an entry in the constant table for that function.  You need to create that same constant table entry in your assembly.

    More background ... The ARM instruction set can only handle very limited literal constants.  I forget which ones.  Probably 0, 1, 2, and that might be it.  If you need to load a constant that is not one of those, then you need to assign a constant value to a memory location, then load the contents of that memory location.  These memory locations for constants are usually collected together into what is termed a constant table.  Offsets to the constant table are computed as offsets from the PC.  Thus, constant tables are usually in the same section as the code which uses them.

    Thanks and regards,

    -George

  • The $C$CON1 is a label for an entry in the constant table for that function.  You need to create that same constant table entry in your assembly.

    Can you please let me know any reference document or procedure to create constant table entry in assembly?

    Thanks,
    Tushar

  • Tushar Barhate1 said:
    let me know any reference document or procedure to create constant table entry in assembly?

    I'm not aware of any such document.  I recommend you mimic how the compiler does it.  Normally, compiler generated assembly files are not kept after a build.  But, with the option --src_interlist, the assembly files remain, and compiler generated comments are added to help you understand it.  Write some simple C functions that use constants.  Then use --src_interlist to see the assembly code.

    Thanks and regards,

    -George

  • I found another approach and details are as below:

    varA .long 0x4000040D ;defined constant

    LDR             R1, varA    ; load memory address 0x4000040D into R1
    MOV             R0, #0x03 ; move 0x03 into R0
    STRB            R0, [R1]   ; store value 0x03 into memory address 0x4000040D


    Tushar