In the last part I described my MCUs of choice - STM32s. But sometime you need something special. For me this special thing is an real-time safety MCU - Texas Instruments Hercules. This is an ARM-R4-based MCU dedicated for enhanced safety (SIL3). Sounds fancy, right?
TI provides developers with a dedicated tool for configuring the MCU - HALCoGen. It generates startup files and adds all preconfigured HAL libraries to the project for a broad range of IDEs - including Keil V5, which I use.
So te begin with, we run HALCoGen and choose out MCU:
Then choose ARM Compiler (as we will use Keil) and press OK button. HALCoGen will load all the libraries, and after few seconds we can start configuring the MCU:
The amount of options is mind-boggling, and I don't want to go into details about any of them to be honest. On the screen above you see the main screen, showing the block diagram of the MCU. By clicking on any of these modules you can directly go to their respective configuration page(s) with their subpages etc etc. Read some datasheets before starting to do that. View some examples at TIs webpage.
Rememeber that you have to enable drivers for every peripheral that you want to use. It is not done automatically. Also remember about PINMUX, as this is also has to be configured manually.
After you click all the options for your desired MCU configuration, you can generate the code (File->Generate Code or just press F5). After some seconds it will leave you with a bunch of files, that make up your project.
In order to import this files into Keil first start the IDE and select a new project. First, select the MCU (the same that you have chosen in HALCoGen). Then you can import your source files just by right-clicking in the tree and selecting "Add existing files to ...". Finally, after importing all the sources you end with something like this:
After importing all the *.c files you can start developing your application. Mainly sys_main.c and notification.c will be of interest for you. The first one is the file where main code is, and the second one handles the
And that's it! have fun developing with your Hercules.