porting ChibiOS to STM32373C-EVAL

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

madokapeng
Posts: 14
Joined: Thu Nov 21, 2013 4:44 am

Re: porting ChibiOS to STM32373C-EVAL

Post by madokapeng »

Giovanni wrote:Hi,

Look at the Makefiles of the F3 demos and find the "include" (there are several of them), those .mk files contain all paths you have to use in your project.

Giovanni


Thanks for supporting

I will give it a shot.
madokapeng
Posts: 14
Joined: Thu Nov 21, 2013 4:44 am

Re: porting ChibiOS to STM32373C-EVAL

Post by madokapeng »

Giovanni wrote:Hi,

Look at the Makefiles of the F3 demos and find the "include" (there are several of them), those .mk files contain all paths you have to use in your project.

Giovanni


I am confusing about RVCT.
I looked at F3 demos, the include files are in os\ports\GCC folder instead of os\ports\RVCT. can I specify os\ports\GCC in Keil IDE environment.
My question is novice, I am really new to RTOS.

Thank you
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: porting ChibiOS to STM32373C-EVAL

Post by Giovanni »

Of course the only paths you have to change are those containing GCC and point them to the RVCT directories.

This reminds me that you have to create the vector.s file for the STM32F3 because there is not one done, you could use the one of the F4 and remove the excess vectors. Put the files into .\os\ports\RVCT\ARMCMx\STM32F3xx and point your project there.

Giovanni
madokapeng
Posts: 14
Joined: Thu Nov 21, 2013 4:44 am

Re: porting ChibiOS to STM32373C-EVAL

Post by madokapeng »

Giovanni wrote:Of course the only paths you have to change are those containing GCC and point them to the RVCT directories.

This reminds me that you have to create the vector.s file for the STM32F3 because there is not one done, you could use the one of the F4 and remove the excess vectors. Put the files into .\os\ports\RVCT\ARMCMx\STM32F3xx and point your project there.

Giovanni


How do I know what are the excess vectors by looking at vector.s of F4?
Is there a way to tell the vector difference between F4 and F3?

Thank you
madokapeng
Posts: 14
Joined: Thu Nov 21, 2013 4:44 am

Re: porting ChibiOS to STM32373C-EVAL

Post by madokapeng »

ok, got it

look at datasheet

Thanks for the hints
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: porting ChibiOS to STM32373C-EVAL

Post by Giovanni »

Not the datasheet, there is a section on the Reference Manual. You may also look at vectors.c for GCC :)

Giovanni
madokapeng
Posts: 14
Joined: Thu Nov 21, 2013 4:44 am

Re: porting ChibiOS to STM32373C-EVAL

Post by madokapeng »

Giovanni wrote:Not the datasheet, there is a section on the Reference Manual. You may also look at vectors.c for GCC :)

Giovanni

After I compiled, it comes following errors. What could be causing those errors?
I followed exact what we discussed before


Rebuild target 'Target 1'
compiling main.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
main.c(21): error: #20: identifier "GPIO_TypeDef" is undefined
palSetPad(GPIOC, GPIOC_LED1);
main.c(21): error: #29: expected an expression
palSetPad(GPIOC, GPIOC_LED1);
main.c(23): error: #29: expected an expression
palClearPad(GPIOC, GPIOC_LED2);
main.c(34): error: #20: identifier "GPIO_TypeDef" is undefined
palSetPad(GPIOC, GPIOC_LED1);
main.c(34): error: #29: expected an expression
palSetPad(GPIOC, GPIOC_LED1);
main.c(36): error: #29: expected an expression
palClearPad(GPIOC, GPIOC_LED2);
main.c: 0 warnings, 7 errors
compiling chcond.c...
compiling chdebug.c...
compiling chdynamic.c...
compiling chevents.c...
compiling chheap.c...
compiling chlists.c...
compiling chmboxes.c...
compiling chmemcore.c...
compiling chmempools.c...
compiling chmsg.c...
compiling chmtx.c...
compiling chqueues.c...
compiling chregistry.c...
compiling chschd.c...
compiling chsem.c...
compiling chsys.c...
compiling chthreads.c...
compiling chvt.c...
compiling adc.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\src\adc.c: 0 warnings, 1 error
compiling hal.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\src\hal.c: 0 warnings, 1 error
compiling pal.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\src\pal.c(82): error: #132: expression must have pointer-to-struct-or-union type
return palReadGroup(bus->portid, bus->mask, bus->offset);
os\hal\src\pal.c(108): error: #132: expression must have pointer-to-struct-or-union type
palWriteGroup(bus->portid, bus->mask, bus->offset, bits);
os\hal\src\pal.c: 0 warnings, 3 errors
compiling pwm.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\src\pwm.c: 0 warnings, 1 error
compiling serial.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\src\serial.c: 0 warnings, 1 error
compiling spi.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\src\spi.c: 0 warnings, 1 error
compiling hal_lld.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32F37x\hal_lld.c: 0 warnings, 1 error
compiling stm32_dma.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32F37x\stm32_dma.c: 0 warnings, 1 error
compiling pal_lld.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(82): error: #20: identifier "RCC_APB2ENR_IOPAEN" is undefined
rccEnableAPB2(APB2_EN_MASK, FALSE);
os\hal\platforms\STM32\GPIOv1\pal_lld.c(82): error: #20: identifier "RCC_APB2ENR_IOPBEN" is undefined
rccEnableAPB2(APB2_EN_MASK, FALSE);
os\hal\platforms\STM32\GPIOv1\pal_lld.c(82): error: #20: identifier "RCC_APB2ENR_IOPCEN" is undefined
rccEnableAPB2(APB2_EN_MASK, FALSE);
os\hal\platforms\STM32\GPIOv1\pal_lld.c(82): error: #20: identifier "RCC_APB2ENR_IOPDEN" is undefined
rccEnableAPB2(APB2_EN_MASK, FALSE);
os\hal\platforms\STM32\GPIOv1\pal_lld.c(82): error: #20: identifier "RCC_APB2ENR_IOPEEN" is undefined
rccEnableAPB2(APB2_EN_MASK, FALSE);
os\hal\platforms\STM32\GPIOv1\pal_lld.c(82): error: #20: identifier "RCC_APB2ENR_AFIOEN" is undefined
rccEnableAPB2(APB2_EN_MASK, FALSE);
os\hal\platforms\STM32\GPIOv1\pal_lld.c(87): error: #20: identifier "GPIO_TypeDef" is undefined
GPIOA->ODR = config->PAData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(87): error: #29: expected an expression
GPIOA->ODR = config->PAData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(88): error: #29: expected an expression
GPIOA->CRH = config->PAData.crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(89): error: #29: expected an expression
GPIOA->CRL = config->PAData.crl;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(90): error: #29: expected an expression
GPIOB->ODR = config->PBData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(91): error: #29: expected an expression
GPIOB->CRH = config->PBData.crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(92): error: #29: expected an expression
GPIOB->CRL = config->PBData.crl;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(93): error: #29: expected an expression
GPIOC->ODR = config->PCData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(94): error: #29: expected an expression
GPIOC->CRH = config->PCData.crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(95): error: #29: expected an expression
GPIOC->CRL = config->PCData.crl;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(96): error: #29: expected an expression
GPIOD->ODR = config->PDData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(97): error: #29: expected an expression
GPIOD->CRH = config->PDData.crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(98): error: #29: expected an expression
GPIOD->CRL = config->PDData.crl;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(100): error: #29: expected an expression
GPIOE->ODR = config->PEData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(101): error: #29: expected an expression
GPIOE->CRH = config->PEData.crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(102): error: #29: expected an expression
GPIOE->CRL = config->PEData.crl;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(104): error: #29: expected an expression
GPIOF->ODR = config->PFData.odr;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(105): error: #29: expected an expression
GPIOF->CRH = config->PFData.crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(106): error: #29: expected an expression
GPIOF->CRL = config->PFData.crl;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(158): error: #132: expression must have pointer-to-struct-or-union type
port->BSRR = mask;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(160): error: #132: expression must have pointer-to-struct-or-union type
port->BRR = mask;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(178): error: #132: expression must have pointer-to-struct-or-union type
port->CRH = (port->CRH & mh) | crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c(178): error: #132: expression must have pointer-to-struct-or-union type
port->CRH = (port->CRH & mh) | crh;
os\hal\platforms\STM32\GPIOv1\pal_lld.c: 0 warnings, 30 errors
compiling spi_lld.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32\SPIv1\spi_lld.c: 0 warnings, 1 error
compiling adc_lld.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32F37x\adc_lld.c: 0 warnings, 1 error
compiling pwm_lld.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32\TIMv1\pwm_lld.c: 0 warnings, 1 error
compiling serial_lld.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
os\hal\platforms\STM32\USARTv1\serial_lld.c(111): error: #136: struct "<unnamed>" has no field "SR"
u->SR = 0;
os\hal\platforms\STM32\USARTv1\serial_lld.c(112): error: #136: struct "<unnamed>" has no field "SR"
(void)u->SR; /* SR reset step 1.*/
os\hal\platforms\STM32\USARTv1\serial_lld.c(113): error: #136: struct "<unnamed>" has no field "DR"
(void)u->DR; /* SR reset step 2.*/
os\hal\platforms\STM32\USARTv1\serial_lld.c(138): error: #20: identifier "USART_SR_ORE" is undefined
if (sr & USART_SR_ORE)
os\hal\platforms\STM32\USARTv1\serial_lld.c(140): error: #20: identifier "USART_SR_PE" is undefined
if (sr & USART_SR_PE)
os\hal\platforms\STM32\USARTv1\serial_lld.c(142): error: #20: identifier "USART_SR_FE" is undefined
if (sr & USART_SR_FE)
os\hal\platforms\STM32\USARTv1\serial_lld.c(144): error: #20: identifier "USART_SR_NE" is undefined
if (sr & USART_SR_NE)
os\hal\platforms\STM32\USARTv1\serial_lld.c(159): error: #136: struct "<unnamed>" has no field "SR"
uint16_t sr = u->SR; /* SR reset step 1.*/
os\hal\platforms\STM32\USARTv1\serial_lld.c(160): error: #136: struct "<unnamed>" has no field "DR"
uint16_t dr = u->DR; /* SR reset step 2.*/
os\hal\platforms\STM32\USARTv1\serial_lld.c(163): error: #20: identifier "USART_SR_ORE" is undefined
if (sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE | USART_SR_PE))
os\hal\platforms\STM32\USARTv1\serial_lld.c(163): error: #20: identifier "USART_SR_NE" is undefined
if (sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE | USART_SR_PE))
os\hal\platforms\STM32\USARTv1\serial_lld.c(163): error: #20: identifier "USART_SR_FE" is undefined
if (sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE | USART_SR_PE))
os\hal\platforms\STM32\USARTv1\serial_lld.c(163): error: #20: identifier "USART_SR_PE" is undefined
if (sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE | USART_SR_PE))
os\hal\platforms\STM32\USARTv1\serial_lld.c(166): error: #20: identifier "USART_SR_LBD" is undefined
if (sr & USART_SR_LBD) {
os\hal\platforms\STM32\USARTv1\serial_lld.c(170): error: #136: struct "<unnamed>" has no field "SR"
u->SR &= ~USART_SR_LBD;
os\hal\platforms\STM32\USARTv1\serial_lld.c(173): error: #20: identifier "USART_SR_RXNE" is undefined
if (sr & USART_SR_RXNE) {
os\hal\platforms\STM32\USARTv1\serial_lld.c(179): error: #20: identifier "USART_SR_TXE" is undefined
if ((cr1 & USART_CR1_TXEIE) && (sr & USART_SR_TXE)) {
os\hal\platforms\STM32\USARTv1\serial_lld.c(188): error: #136: struct "<unnamed>" has no field "DR"
u->DR = b;
os\hal\platforms\STM32\USARTv1\serial_lld.c(192): error: #20: identifier "USART_SR_TC" is undefined
if (sr & USART_SR_TC) {
os\hal\platforms\STM32\USARTv1\serial_lld.c(197): error: #136: struct "<unnamed>" has no field "SR"
u->SR &= ~USART_SR_TC;
os\hal\platforms\STM32\USARTv1\serial_lld.c: 0 warnings, 21 errors
compiling chcore.c...
compiling chcore_v7m.c...
assembling chcoreasm_v7m.s...
assembling cstartup.s...
assembling vectors.s...
compiling nvic.c...
compiling board.c...
.\os\hal\platforms\STM32\GPIOv1\pal_lld.h(122): error: #20: identifier "GPIO_TypeDef" is undefined
typedef GPIO_TypeDef * ioportid_t;
conf\board.c(28): error: #146: too many initializer values
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
conf\board.c(30): error: #146: too many initializer values
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
conf\board.c(32): error: #146: too many initializer values
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
conf\board.c(34): error: #146: too many initializer values
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
conf\board.c(36): error: #146: too many initializer values
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
conf\board.c(38): error: #146: too many initializer values
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
conf\board.c: 0 warnings, 7 errors
".\myproject.axf" - 78 Error(s), 0 Warning(s).
Target not created
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: porting ChibiOS to STM32373C-EVAL

Post by Giovanni »

Probably you are missing an inclusion directory: ./os/hal/platforms/STM32F37x

Giovanni
Post Reply