Page 1 of 1

Using latest ChibiOS and ChibiStudio with Tiva requires a few small changes

Posted: Tue Oct 13, 2020 2:17 am
by mtrescott
Just getting started with ChibiOS using the TM4C123GXL port! Looks like it's gotten a little dusty unfortunately, but the changes I needed to make were pretty minor:

1. Get a copy of OpenOCD with the TI-ICDI driver enabled
On openSUSE Linux the OpenOCD package already has this driver enabled. However, the OpenOCD binary currently shipped with ChibiStudio does not have the TI-ICDI driver enabled. It can be enabled by passing --enable-ti-icdi to the configure script used when building with MSYS2.

I've attached a 7-zip archive file with a copy of OpenOCD that's been compiled with the TI-ICDI driver enabled, plus an extra patch that fixes potential problems with the WinUSB driver (link to the patch in the enclosed README.txt file). All you have to do is replace the contents of C:\ChibiStudio\tools\openocd with the contents of the openocd folder in the archive file. If you already have TI's Code Composer Studio installed, you're probably good to go. Otherwise, you can use Zadig to install the WinUSB driver so that OpenOCD will work.

2. Set up paths correctly in the Makefile
After importing a Tiva demo project in ChibiStudio, open the Makefile and make sure the variables CHIBIOS and CHIBIOSCONTRIB are set correctly. For example, the lines in my Makefile look like this (your setup may look different):

Code: Select all

# Imported source files and paths
CHIBIOS = ../../../../chibios203

3. Remove inclusion of nonexistant halconf_community.h
Open the file halconf.h and remove the line that reads

Code: Select all

#include "halconf_community.h"

4. Configure ChibiStudio (Eclipse) to be compatible with OpenOCD
A somewhat-recent change in the Eclipse's GDB Hardware Debugging plug-in will throw an error and stop your code from launching (more information here). To fix this, just click the drop-down menu button attached to the "Debug" icon at the top of the screen, click on Debug Configurations..., and then open "RT-TM4C12xx-LAUNCHPAD (OpenOCD, Flash and Run)" from the list on the left-hand side of the dialog. Then, go to the Startup tab and deselect the boxes Reset and delay and Halt. Click on the Apply button and you're good to go.

Good luck & hope this is helpful.

Re: Using latest ChibiOS and ChibiStudio with Tiva requires a few small changes

Posted: Tue Oct 13, 2020 7:50 am
by mtrescott
Oops, here are a couple other things I forgot:

5. Set path correctly for LDSCRIPT variable
You need to change the LDSCRIPT variable in the Makefile to match the following:

Code: Select all

LDSCRIPT= $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld/TM4C123xH6.ld

This is a temporary workaround; I suspect an #if was added to hal_pal.h at some point after the Tiva demos were created (but I haven't had a chance to look at the most recent generic template for halconf.h). If this is not enabled, the palevent_t type will be undefined and you'll get an error "unknown type name 'palevent_t'". In halconf.h, change the line

Code: Select all

#define PAL_USE_CALLBACKS                   FALSE

Code: Select all

#define PAL_USE_CALLBACKS                   TRUE

Hopefully that's everything this time.