hsk_libs-user  163:b63ae088cc97
High Speed Karlsruhe XC878 library collection
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
The Project Makefile

According to the SDCC manual functions called by ISRs must be reentrant or protected from memory overlay.

This is done with a compiler instruction:

#pragma save
#pragma nooverlay
void isr_callback(void) {
[...]
}
#pragma restore

Unfortunately this causes a compiler warning when using C51:

..\src\main.c(49): warning C245: unknown #pragma, line ignored

This can be avoided by making nooverlay conditional:

#pragma save
#ifdef SDCC
#pragma nooverlay
#endif
void isr_callback(void) {
[...]
}
#pragma restore

The project Makefile offers access to all the UNIX command line facilities of the project. The file is written for the FreeBSD make, which is a descendant of PMake. Some convenience and elegance was sacrificed to make the Makefile GNU Make compatible.

Generating the Documentation

The Makefile can invoke Doxygen with the make targets html and pdf:

# make html pdf
Searching for include files...
Searching for example files...
Searching for images...
[...]

The html target creates the directories html/user/ and html/dev/, which contain the HTML version of this documentation.

The pdf target creates the directory pdf/ with the PDF versions of this documentation.

The targets create a Users' and a Developers' Manual. The first only includes documentation for public interfaces (i.e. headers). The second also includes the documentation of the implementation and some additional tidbits in this chapter that are only of interest when developing the libraries instead of building applications with them.

Dependencies

In order to build the documentation the following tools need to be installed on the system:

  • Doxygen
  • GraphViz (for creating dependency graphs)
  • teTeX (for pdflatex)

Building

The Makefile uses SDCC to build. This can be changed in the first lines of the Makefile. The default target build builds all the .c files. Each .c file containing a main() function will also be linked, resulting in a .hex file:

# make
sdcc -mmcs51 [...] -o bin.sdcc/hsk_adc/hsk_adc.rel -c src/hsk_adc/hsk_adc.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_boot/hsk_boot.rel -c src/hsk_boot/hsk_boot.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_can/hsk_can.rel -c src/hsk_can/hsk_can.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_wdt/hsk_wdt.rel -c src/hsk_wdt/hsk_wdt.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_icm7228/hsk_icm7228.rel -c src/hsk_icm7228/hsk_icm7228.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_isr/hsk_isr.rel -c src/hsk_isr/hsk_isr.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_pwc/hsk_pwc.rel -c src/hsk_pwc/hsk_pwc.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_pwm/hsk_pwm.rel -c src/hsk_pwm/hsk_pwm.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_timers/hsk_timer01.rel -c src/hsk_timers/hsk_timer01.c
sdcc -mmcs51 [...] -o bin.sdcc/hsk_flash/hsk_flash.rel -c src/hsk_flash/hsk_flash.c
sdcc -mmcs51 [...] -o bin.sdcc/main.rel -c src/main.c
sdcc -mmcs51 [...] -o bin.sdcc/main.hex bin.sdcc/hsk_timers/hsk_timer01.rel [...]

All compiler output is dumped into the bin.sdcc/ directory. All the .c files are built, independent of whether they are linked into a .hex file.