This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Lookup Assembler (Area - DATA) with Mixed C/Assembler

Hello,
I was wondering if someone could give me some assistance. I am current using the TM4C1294 - Tiva micro-controller and attempting to store a few lists which I would like to use in a Main.c file.
The lists are a little too big to store the data inside my program. (I also need to access the consistently within the nanosecond timeframe (<<100 ns).

The program consists of main.c (C & ASM), system_tm4c129.c,TM4C1294NCPDT.h & startup_TM4C129.s

I have attempted to store data in "startup_TM4C129.s" (Right at the end)

AREA Table, DATA, READONLY
STANDARD_COLOURS DCB 0,0,0,0 ;No Colour / OFF DCB 255,0,0,0 ;Green DCB 0,255,0,0 ;Red
And the list goes on....

The data can be successfully compiled however I am unsure about whether this data can make it past the complication stage (I doubt it).

I am trying to access this list from my main.c(within an assembly insertion) and all I can typically get is #29: expected an expression (LDR R5, =STANDARD_COLOURS). I have been editing the startup.s file but I can't seem to get this working.

I am trying to transfer the address of the table STANDARD_COLOURS(starup.s) to a register so that I can perform successive fast calculations in a consistent manner.

In the past (Solely Assembly program) I have been able to run through a data table but I may have complicated things by trying to use mixed assembly.

Any help would be greatly appreciated - I have spent a considerable amount of time but my expertise is definitely not in programming...

Parents
  • Hi Per,
    Thank you very much for that valuable info (Sort of like teaching a man to fish so he can feed himself).

    I tried what you said. Seems like the register r0 gets loaded with a part of the program counter (and incremented along the way).

    The first address my declare variable would be located was 0x000004D8. I made some minor modifications and saw that my magic reference (0xA1,0xB2,0xC3,0xD4) got moved 8 Bytes.
    I will try and write a simple checker in ASM which locates the position of my reference and then adds another 8 Bytes (Data location).

    As for the inline assembler - Great idea (Hopefully I won't have to dip into ASM code for the next project :~) ). If C was fast enough in this application I would have been finished writing this program on the first day...

    I was starting to get a little desperate ... i.e. trying to use the function memcpy to store at an arbitrary point in memory and then retrieve from that location.

    Thanks for your help

    Martin

Reply
  • Hi Per,
    Thank you very much for that valuable info (Sort of like teaching a man to fish so he can feed himself).

    I tried what you said. Seems like the register r0 gets loaded with a part of the program counter (and incremented along the way).

    The first address my declare variable would be located was 0x000004D8. I made some minor modifications and saw that my magic reference (0xA1,0xB2,0xC3,0xD4) got moved 8 Bytes.
    I will try and write a simple checker in ASM which locates the position of my reference and then adds another 8 Bytes (Data location).

    As for the inline assembler - Great idea (Hopefully I won't have to dip into ASM code for the next project :~) ). If C was fast enough in this application I would have been finished writing this program on the first day...

    I was starting to get a little desperate ... i.e. trying to use the function memcpy to store at an arbitrary point in memory and then retrieve from that location.

    Thanks for your help

    Martin

Children