A confluence of events.
1) I got a TI RM46 launchpad (originally I had an RM42 launchpad).
2) At some point, Adacore released a demo of Ada running on an STM32F407 discovery board. a) I am very familiar with that b) Ada seemed interesting.
3) Adacore supports the TMS570 to its customers and the Ravenscar lib has code to support TMS570 + ARMv7. Adacore provides GPL'd releases of GNAT + libs.
4) Ravenscar provides basic OS services, tasking, delays, wait on an event etc.
5) I detected a win here as in embedded programming a 100% free soln with a typesafe language seems too good to pass up. Plus I get to learn a language and do some basic board design.
6) The Ti Hercules is an interesting proc, Dual Cortex-R4 (or R5) running lockstep with ECC and parity all over the device. These chips are made for control of trains, cars, elevators etc. Detection of faults is their specialty and certification. Interesting to me as its a world I don't inhabit.
7) Programming a Hercules is typically via a GUI (Halcogen) and then modifying the resultant C code. That's great but what if you wanted to try a different way...
8) Ada. A blog post on Adacore described SafeTetris. A Tetris written using the extra checked Spark Ada variant. Spark is used for things like the UK air traffic control system. Anyway this port was on an Atmel CM4 with a link to the code + 1GB free sw slug of all the tools:
9) How to get Ada onto an RM46? Some challenges presented themselves. a) JTAG b) Openocd c) ravenscar library d) flashing
9 a) JTAG
To get Ada going on this platform, coming in via the Launchpads XDS110 USB probe wasn't going to fly as the XDS110 protocol is known to Ti but not to me. I had built a JTAG converter for the RM42 launchpad that converted ARM20 <-> TI14 and that worked fine. This newer launchpad used TI20 and has a micro connector Samtec RSM11002SD & FTR11051SD06. So now I need a board with that surface mount conn on both sides. The launchpad does not populate the site so its 2 connectors to be ordered. OSH park for the board... wait 10 days or so, solder it up and it works, openocd connected. I had some odd results with the Flyswatter2 and finally bought a Jlink clone on ebay for ~$15. That Jlink clone was the answer. WIth the right adapter and suitable Openocd, I was now decoupled from TI code composer studio on the RM46 launchpad.
9 b) Openocd
0.8 had issues with the RM4 HW breakpoints had issues. Also a custom profile was needed of course as the RM4 is not a TMS570. After a lot of time spent, I finally happened across the repository files for openocd and learned how to build it from source (its not dead obvious and you need an up to date machine to build it). Once that was built, I was truly able to debug on the part. hw breakpoints worked smoothly and source debug was possible via GDB. hw watchpoints did not work however, more on that later.
sfp stands for small footprint (there is also zfp (zero) and some certified profiles). I only had access to an sfp source tree. A source dl from http://libre.adacore.com gets you the ravenscar source tree (plus much more). That tree has support for quite a few archs (the LeonX cpu's used in space missions etc) and of course ARMv7 and ARMv7M + localized files for specific ports like the TMS570. Some work needed here, generally I like to run in Thumb state to save on flash space on these targets. The ARMv7 context switch is written for ARM state, some work was needed here and I recently fixed an elusive bug with my Context_Switch change specific to Thumb state.
This project is not 'completed' because flashing still needs to be done by the Ti Uniflash tool. A TBD on this is to port over the Flash021 code to Linux and get that to program the flash via the JLink, I think this should be doable, but it is not done yet.
Tasked programs can be run on the platform that toggle LEDs on the board based on OS delays and OS events....Read more »