Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 3 months ago.
compile error
Hi, compiling this gives me:
MODSERIAL_NUCLEO_F401RE.cpp:5:17: error: 'struct serial_t' has no member named 'index' switch( _serial.index ) {
on
┗━ mbed-drivers 0.11.6 ┣━ mbed-hal 1.2.0 yotta_modules/mbed-hal ┃ ┗━ mbed-hal-st 1.0.0 yotta_modules/mbed-hal-st ┃ ┗━ mbed-hal-st-stm32f4 1.1.1 yotta_modules/mbed-hal-st-stm32f4 ┃ ┣━ uvisor-lib 1.0.11 yotta_modules/uvisor-lib ┃ ┣━ mbed-hal-st-stm32cubef4 1.0.2 yotta_modules/mbed-hal-st-stm32cubef4 ┃ ┗━ mbed-hal-st-stm32f401re 0.1.1 yotta_modules/mbed-hal-st-stm32f401re
any hints would be appreciated :)
Thanks, Andreas
Question relating to:
1 Answer
8 years, 3 months ago.
Quick test shows that it compiles fine for me with the online compiler. Using most recent mbed and most recent MODSERIAL. That would be something you can check if thats also the case for you (if the mbed lib is a few revisions outdated it shouldn't be an issue, the MODSERIAL one is older than a few revisions).
Plan B is that you can check if your code does work in the online compiler.
Also just to be sure: You are compiling for the Nucleo F401?
serial_t is defined here: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/a11c0372f0ba/targets/hal/TARGET_STM/TARGET_STM32F4XX/objects.h (as serial_s, but on the common mbed level it is called serial_t), and there you see index being part of the struct.
Thanks for the fast replay i guess i made a mistake when setting up my environment. I'm new to mbed and i'm using yotta on arm-gcc, for the f401re:
$ yotta target st-nucleo-f401re-gcc 0.2.0 mbed-gcc 1.1.0
I also have a objects.h in my local env, but the serial_s looks different from the url that you sent?
$ find . -name "objects.h" ./yotta_modules/mbed-hal-st-stm32f4/mbed-hal-st-stm32f4/objects.h $ grep -A 8 serial_s ./yotta_modules/mbed-hal-st-stm32f4/mbed-hal-st-stm32f4/objects.h struct serial_s { PinName pin_tx; PinName pin_rx; uint8_t module; uint32_t event; uint8_t char_match; };
I'm going to test this again using the online compiler, and again using yotta, probably something messed up there...
Thanks, Andreas
posted by 01 Jan 2016Try it:
include the mbed library with this snippet
#ifdef TARGET_NUCLEO_F411RE #include "MODSERIAL.h" void MODSERIAL::setBase(void ) { switch( _serial.serial.index ) { case 0: _base = USART1; _IRQ = USART1_IRQn; break; case 1: _base = USART2; _IRQ = USART2_IRQn; break; case 5: _base = USART6; _IRQ = USART6_IRQn; break; default: _base = NULL; _IRQ = (IRQn_Type)NULL; break; } } void MODSERIAL::initDevice(void) {}; bool MODSERIAL::txIsBusy( void ) { return ( (((USART_TypeDef*)_base)->SR & ( 1UL << 6 )) == 0 ) ? true : false; } #endif
It works for me
posted by 19 Sep 2016