Code Composer Studio

Code Composer Studio

Home Forums Real-Time Kernels Code Composer Studio

This topic contains 18 replies, has 3 voices, and was last updated by  David Hohl 1 year, 8 months ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #23138

    David Hohl
    Participant

    I am trying to get the uC/OS-II code for the TI DK-TM4C129X board to work with Code Composer Studio. I am having all sorts of issues with compiler-specific include files not being present, not to mention errors when trying to assemble .asm and .s files. I noticed in the blog (see https://www.micrium.com/ucos-iii-v3-04-05/) that there is a mention of a port of uC/OS-III for CCS, but I could not find it anywhere. I thought it might help me figure out what I need to do to get stuff working.

    Any idea where that CCS port might be? Or is there an application note somewhere regarding porting to CCS? I am surprised that Micrium does not seem to support that tool.

    Thanks,

    Dave

    #23141

    Farukh Chaudhry
    Participant

    David,

    The best way is to start a new project based on the MCU and copy all Micrium files into the project directory. You can use existing BSP files for a similar MCU and modify them for your MCU. It may take some time, but will be worth the effort. Can you provide details on the compiler errors?

    Regards,

    Farukh

    #23154

    David Hohl
    Participant

    Hi, Farukh,

    The problem is that I am trying to build a project in Code Composer Studio, and Micrium does not have a project for the Tiva CPU I am using with a CCS port. I found a CCS project for the TI MSP432 family, which is also an ARM chip. I tried using files from that project, and was finally able to get things to build. But when I try to run the code it is branching to address 0x00000000 for some reason (deep in the RTOS assembly code) and craps out.

    Regards,

    Dave

    #23155

    David Hohl
    Participant

    I stepped through the assembly code, and I found where things are going wrong. In the function OSStartHighRdy in os_cpu_a.asm, the very last instruction is “BX R1”. The contents of R1 at that time is 0. From what I can tell, R1 is supposed to have been loaded with the address of the start task, but for some reason that is not happening.

    Does anyone have any idea what might be going wrong?

    Thanks,

    Dave

    Update: If I break at the BX instruction and manually load the address of the start task into R1, the start task begins to execute, although it behaves strangely. If I set a breakpoint where the LED is toggled, the LED turns on and off just fine. But if I just free run the LED always stays green. Very bizarre.

    • This reply was modified 1 year, 11 months ago by  David Hohl.
    #23166

    Fernando Flores
    Keymaster

    Hello David,

    I will assume the following:
    * You created a TM4C129X bare-metal project in CCS, which runs fine.
    * You added TM4C129X BSP, uC/CPU, uC/LIB and uC/OS-II to your workspace
    * you added the uCOS-II/Ports/ARM-Cortex-M/ARMv7-m/CCS port files from the Micrium MSP432 project.
    * You modified the startup file from you bare-metal project to match something similar as the IAR or Keil startup files provided with the Micrium TM4C129X project.

    The issue you are describing is normally due to a workspace setup, startup configuration or flash loader. if you could provide your workspace with full source code and the version CCS you are using, I could take a look at it and see where the problem is.

    Regards,
    Fernando

    #23168

    David Hohl
    Participant

    Hi, Fernando,

    Your assumptions are mostly accurate. I took the tm4c129nczad_startup_ccs.c file from an existing working project and merged the Micrium files in. I do not recall modifying that startup file to match the IAR files, though, so perhaps I need to take a look at that.

    I am using CCS 8.0.0.00016. How do I go about uploading a zipped project file?

    Thanks,

    Dave

    #23169

    David Hohl
    Participant

    I double-checked, and the CCS startup file I use seems to have all the same stuff that the IAR and Keil versions have.

    Regards,

    Dave

    #23171

    Fernando Flores
    Keymaster

    David,

    If you could create a dropbox folder and share the link with me. I should be able to download it.

    Regards,
    Fernando

    #23172

    David Hohl
    Participant

    Hi, Fernando,

    Here is a link to the file:

    https://www.dropbox.com/s/hjqew6icu7tk2e4/VIO-CPU-Port.zip?dl=0

    Thanks for your help!

    Regards,

    Dave

    #23178

    Farukh Chaudhry
    Participant

    Hello David,

    As Fernando indicated, those are the steps that are required. I did the same procedure in generating a STM32F4 Discovery board project using Atollic TrueSTUDIO.

    Regards,

    Farukh

    #23179

    David Hohl
    Participant

    I took a closer look at my cstartup file, and found that I have not initialized the IVT with the PendSV and SysTick handlers. Not sure if that would cause the problem with not branching to the startup task, but it definitely explains why the LED doesn’t blink after I manually force invocation of the startup task. I will fix the cstartup file and see what happens.

    #23181

    David Hohl
    Participant

    Adding the PendSV and SysTick handlers fixed the LED blink problem.

    I still have the issue with the R1 register containing 0x00000000 when the “BX R1” command is reached, though. I noticed, however, that if I do a “Restart” in the CCS debugger R1 does contain the starting address of the startup task. This seems to indicate that the problem is not in the Micrium code, but rather a debugger related issue. If, after loading the code, I disconnect the JTAG and cycle power on the board, the code seems to run okay.

    Unless someone has an insight into what may be going wrong with the debugger the first time executing the code, I think my issues are resolved. Thank you, Fernando and Farukh, for taking the time to respond to my posts.

    Regards,

    Dave

    #23182

    David Hohl
    Participant

    Looks like I spoke too soon! The Restart trick worked for a while, but now (without changing anything) R1 always has 0x00000000 when I hit the BX instruction. And even if I enter the proper address in R1 and launch the startup task, the LED does not blink. If I set a breakpoint where the LED is toggled, though, things work fine. And they work fine if I run with the JTAG disconnected.

    Update: It turns out I need to do a CPU reset — not just a restart — to get things to work.

    • This reply was modified 1 year, 11 months ago by  David Hohl.
    #23183

    Fernando Flores
    Keymaster

    David,

    I tracked down the issue to line 238 “MSR CONTROL, R0” in os_cpu_a.asm. This line of code is not modifying bit1 of the CONTROL register, which is what the port needs to use PSP as the current stack Pointer. This is the reason why the CPU registers are not being loaded with the correct Task Stack values to context switch. If I manually modify this bit then the registers are loaded with the proper values. Therefore, this might be an issue more with TI compiler or Segger Jlink emulator that TI provides. The XDS-ICDI debugger on my board is not working so I cannot test using the built-in debugger.

    Could you try using the XDS-ICDI debugger and see if bit1 of the CONTROL register is being written? if bit1 is not being written, then this will be a question for TI Forum.

    Regards,
    Fernando

    #23185

    David Hohl
    Participant

    Very interesting, Fernando! Resetting the CPU might fix something that is causing that bit not to be set. I will give it a try with the IDCI and let you know.

    Regards,

    Dave

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic.

View the complete site map

x
Loading...