Help with Flashing TMS570

Im trying to deploy RTEMS to a TMS570LC43HDK.

From the bsp’s readme it looks like the options are external SDRAM or and directly to flash.

I prefer going directly to flash.

The readme mentions using openOCD to do direct programing, but TI’s CCS IDE is able to talk to the on board XDS100v2 that is the normal method of flashing over usb.

Does anyone have experience importing a RTEMS built ELF into CCS and using it flash to board?

I’ve had success in the past using TI HALcoGEN and CCS to create FreeRTOS projects. Trying to evaluate porting those project to RTEMS

@ppisa any advice on this?

also been trying to peruse the openocd route in the meantime.

openocd seems to supports the the LS31 variant out of the box but not the LC43.

I tried modifying their LS31 script, but it does support cortex_r5 (just the r4 used by LS31)

I followed the githup openocd fork that was in the bsp readme, but found the same result there. They seem in line with upstream not sure what they added. might just be case of old bsp readme

after resorting to some vib coding I have a working openocd script and Im able to connect gdb and direct write/read ram. I don’t have a working flash driver and could not just use the load command to write a RTEMS elf.

tomorrow i might try manually unpacking a elf with object copy and writing to ram and then jumping. Or may I’ll find a pseudo bootloader and borrow a SD card

The TMS570 targets are interesting for RTEMS because they have space-grade/qualified variants and have heritage, i.e. Ingenuity helicopter on Mars. But that target is really difficult.

As for RTEMS BSP variants, the internal SRAM version is easy and can be send to the target by mainline OpenOCD. But the size of program is really limited. For development, we have used mainly TMS570LS3137 with startup standalone system-less code built by CCS which has initialized safety functions and SDRAM controller and then it wait for program load by OpenOCD. The some version of that application is there https://github.com/hornmich/tms570ls3137-hdk-sdram. It offspring of our project for Porsche and EATON, unfortunately based on FreeRTOS and CCS which provided broken LwIP and required lot time to make that mess working. The related thesis there but in Czech language, sorry.

Then we have two setups with running applications from Flash, one with bootloader based on FreeRTOS which allowed sending of images over XCP on Ethernet and another where RTEMS BSP is compilled with TMS570_USE_HWINIT_STARTUP enabled when RTEMS started directly from boot in Flash.

The flashing of the externally build binary is possible by CCS and modified OpenOCD.

With CCS we have used for command line invocation on Linux something like this

#! /bin/sh
# This script executes LoadTI for DSS Linux

export LOADTI_PATH=$(dirname $(which $0))
${CCS_SCRIPTING:=/opt/ti/ccsv5/ccs_base/scripting/}/bin/dss.sh $LOADTI_PATH/main.js $@

Where provided main.js written in JavaScript has invoked flashing in Eclipse style with prepared TMS570LS3137.ccxml file. I can try locate these files and more but it is 10 years ago, so it would require more time. The Flashing of external binary from GUI was possible as well.

We have managed OpenOCD to work with the target but the code has been based on other developer fork and the main problem is that the stub send to target to process actual flashing has been based on Texas Instruments F021 flash library because there was no documentation of required registers and algorithms. And that library has been closed source so no go for OpenOCD mainline. My patches and OpenOCD variant for TMS570LS3137 is available there https://cmp.felk.cvut.cz/~pisa/tms570/. I have compiled old OpenOCD version successfully some years ago. But it can be problem today.

But I have spoken with Texas Instruments representatives about these difficulties on this year Embedded World and they informed me, that their policy changes and that they support OpenOCD for some of their, probably newer chips. But there is not direct replacement for Hercules family in the fact and they plan to produce it still and there is chance to do something with this. As it would help my colleagues at https://www.elektroline.cz/ as well, because they are using some Hercules chips and would be happy to flash them from ARM GNU/Linux based tester on the production line, I can try to contact people at TI if there is chance to get information and join forces. The tools used with our TMS570 OpenOCD fork can be found there https://github.com/AoLaD/rtems-tms570-utils. The related thesis documenting development of RTEMS TMS570 BSO, again in Czech sic, there.

But on the other hand, I would suggest to consider alternative to development cycle based on chip flashing for each iteration. The Flash memory of these chips has really limited number of erased cycles specified, about one thousand if I remember well. So use of the Flash erase and load for each test could lead to unusable board in relatively short time.

I have interest in this target so I try to provide some knowledge and hints as my time allow. But cannot promise much till the end of semester, we have 160 students enlisted in the course.

Thank you. I’ll take a look at some of these forks. Please no rush on digging up code. looks like we will be moving to a xilinx target. I’m with you on the broken TI LwIP. I had to do a bunch of porting to get it to work in Free RTOS for last project.

How is the sd card route. Is there a boot loader repo you would recommend? Do I just place the RBS built test exes for the tms570lc4357_hdk_sdram bsp onto the card, or do I need to modify them?

We have had no loader from SD card. The SDRAM has been used for testing such way, that the CCS based code has started from Flash and configured clocks and SDRAM controller and then OpenOCD has been used to fill SDRAM with application which has been started there. It would be possible to prepare loader etc. but we have loader only for XCP over Ethernet. I am not sure if we used it even for SDRAM loading but it would be easy extension if not implemented yet.

By the way, XCAN support for RTEMS CAN/CAN FD stack is another option for improvement. We have functional only CTU CAN FD and OpenCores SJA1000 on Zynq by now. As for D-CAN, there seems to be GSoC project to implement it on BeagleBoneBlack which can be easier target for start and I believe that code can be used on TMS570 then as well.