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.

CCS/TM4C123GH6PM: Writing assembly code in code composer studio for TM4C123.

Part Number: TM4C123GH6PM


Tool/software: Code Composer Studio

Hi , I am developing small OS with tm4c123(ARM cortex M4 processor) . So for context save and restore i need to write small code in assembly language . I tried to create source file with .asm extension in code composer studio. But I have  to access few globle  variables declared in main c main as shown below . 

I have no clear idea how to do it in CCS and one one doubt is how to call function defined in .asm source file .

 LDR R0 , =Runptr    // Runptr is declared in other source file which is .c file 

CCS is showing 

Multiple markers at this line
- [E0003] Unexpected trailing operand(s)
- [E0001] Illegal symbol
- [E0200] Bad term in expression

Thank you 

Indrajit.

  • Hello Indrajit,

    We aren't able to provide support for assembly-level code. There are many existing RTOS to choose from, of course including our own TI-RTOS, but others such as FreeRTOS as well. In addition to that, we have a full driver library in our TivaWare solution. With all of these resources available, our focus is supporting these resources. I would advice you look into these, as we (and other 3rd parties in the case of non TI-RTOS) have invested much time and energy to making robust firmware for all to use without needing to dig through assembly level instructions.
  • Here is a link to the Assembly Tool User's Guide for the assembler that comes with the TI ARM compiler. You will find the directives used to define and reference global symbols ( .global, .def, and .ref) on page 116.
    www.ti.com/.../spnu118t.pdf

    Also take a look at the syntax used in the disassembly window of Code Composer.

    See section 6.6 of the TI ARM C-compiler manual for information on interfacing Assembly routines with C functions.
    www.ti.com/.../spnu151q.pdf
  • And - if after vendor advice (en masse) proves (somehow) insufficient ... Joseph Yiu's book, "The Definitive Guide to the ARM Cortex M3/M4" details the successful integration of "ASM" w/in a primarily "C" framework.
  • It is nice to see someone wanting to do some assembly who actually has a justification.

    If you are just want to get an RTOS running Ralph's point is a good one, there are free and freely available RTOS's. I've also done a light RTK using the Cortex interrupt structure entirely in C so depending on what you need that can work as well.

    However if you need something like EDF scheduling I don't think either of the RTOSes support that.

    And finally you should be able to get your compiler to spit out an intermediate assembly file. If you can't I would consider it broken but there are a few broken compilers around.

    Robert
  • Hi ,
    Thank you for reply.
    I will go through reference manual as well as Joseph Yiu's book.
    And finally I need to search suitable compiler for me. Because as far I know to save and restore context we need to write it in assembly and scheduling can done in c . Please correct me if I am wrong .
    Thanks again.