Code: Select all
/**
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM FALSE
#endif
...but overwrite them at the beginning of "halconf.h":
Code: Select all
// ---------- Overwrites ----------
#define HAL_USE_PWM TRUE
// ---------------------------------------------------
/**
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM FALSE
#endif
That works correctly.
However, if I write my overrides in another file (halconf_overrides.h) and include it halconf.h:
Code: Select all
... (halconf.h beginning)
#include "halconf_overrides.h"
...
... it throws compilation errors:
Code: Select all
/home/aea/sw2/include/ramp.c:21: undefined reference to `pwmStart'
/home/aea/sw2/include/ramp.c:22: undefined reference to `pwmEnableChannel'
/home/aea/sw2/include/ramp.c:29: undefined reference to `pwmChangePeriod'
/home/aea/sw2/include/ramp.c:30: undefined reference to `pwmEnableChannel'
/home/aea/sw2/include/ramp.c:34: undefined reference to `pwmStop'
/home/aea/sw2/include/ramp.c:38: undefined reference to `PWMD1'
/tmp/ccilWRV1.ltrans10.ltrans.o: In function `halInit':
/home/aea/ChibiOS/os/hal/src/hal.c:102: undefined reference to `pwmInit'
collect2: error: ld returned 1 exit status
/home/aea/ChibiOS/os/common/startup/ARMCMx/compilers/GCC/rules.mk:261: recipe for target 'build/ch.elf' failed
make: *** [build/ch.elf] Error 1
I'm sure that my "halconf_overrides.h" is included because when I add "#error hello world", "make" throws this "hello world" error.
What is the correct way to split this file?