Compiling problems
Posted: Mon Aug 14, 2017 10:56 pm
Hi all,
I am trying to learn how to use ChibiOS. I am using the BluePill port as a start. I compiled it and flashed successfully onto the board. The board blinks..
Then I changed the code to the following to test out serial communication.
[spoil][/spoil]
I set HAL_USE_SERIAL and HAL_USE_PAL as TRUE in halconf.h. The compilation fails on unknown types and undefined references.
[spoil][/spoil]
Any hints on where should I look? Thank you in advance.
I tried to disable the "SMART_BUILD" with no luck. I assume, it is something I overlooked.
My environment:
* clean Debian install (9.1)
* arm-none-eabi-gcc (15:5.4.1+svn241155-1) 5.4.1 20160919 from official Debian repository
* GNU Make 4.1
* the clone of the mentioned git repo
* NOT using the ChibiStudio
I am trying to learn how to use ChibiOS. I am using the BluePill port as a start. I compiled it and flashed successfully onto the board. The board blinks..
Then I changed the code to the following to test out serial communication.
[spoil]
Code: Select all
#include "ch.h"
#include "hal.h"
#include "serial.h"
static SerialConfig uart_cfg = {
57600, /* rate */
};
int main(void)
{
char data[] = "Hello World!\n\r";
halInit();
chSysInit();
/* USART1_TX & USART1_RX */
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
sdStart(&SD1, &uart_cfg);
while (1) {
sdWrite(&SD1, (uint8_t *) data, 14);
palSetPad(GPIOC, GPIOC_LED);
chThdSleepMilliseconds(1000);
palClearPad(GPIOC, GPIOC_LED);
chThdSleepMilliseconds(1000);
}
return 0;
}I set HAL_USE_SERIAL and HAL_USE_PAL as TRUE in halconf.h. The compilation fails on unknown types and undefined references.
[spoil]
Code: Select all
Compiling main.c
main.c:8:8: error: unknown type name 'SerialConfig'
static SerialConfig uart_cfg = {
^
In file included from ChibiOS/os/hal/include/pal.h:113:0,
from ChibiOS/os/hal/include/hal.h:46,
from main.c:4:
main.c: In function 'main':
main.c:20:30: warning: implicit declaration of function 'PAL_MODE_ALTERNATE' [-Wimplicit-function-declaration]
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
^
ChibiOS/os/hal/ports/STM32/LLD/GPIOv1/pal_lld.h:342:47: note: in definition of macro 'pal_lld_setgroupmode'
_pal_lld_setgroupmode(port, mask << offset, mode)
^
ChibiOS/os/hal/include/pal.h:527:3: note: in expansion of macro 'palSetGroupMode'
palSetGroupMode(port, PAL_PORT_BIT(pad), 0U, mode)
^
main.c:20:5: note: in expansion of macro 'palSetPadMode'
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
^
main.c:22:5: warning: implicit declaration of function 'sdStart' [-Wimplicit-function-declaration]
sdStart(&SD1, &uart_cfg);
^
main.c:22:14: error: 'SD1' undeclared (first use in this function)
sdStart(&SD1, &uart_cfg);
^
main.c:22:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:9: warning: implicit declaration of function 'sdWrite' [-Wimplicit-function-declaration]
sdWrite(&SD1, (uint8_t *) data, 14);
^
ChibiOS/os/common/ports/ARMCMx/compilers/GCC/rules.mk:216: recipe for target 'build/obj/main.o' failed
make: *** [build/obj/main.o] Error 1Any hints on where should I look? Thank you in advance.
I tried to disable the "SMART_BUILD" with no luck. I assume, it is something I overlooked.
My environment:
* clean Debian install (9.1)
* arm-none-eabi-gcc (15:5.4.1+svn241155-1) 5.4.1 20160919 from official Debian repository
* GNU Make 4.1
* the clone of the mentioned git repo
* NOT using the ChibiStudio