I'm looking at the STM32 provided Ethernet examples that use an RTOS and have the ethernetif_input function.
The function is started as a task as below:
static void low_level_init(struct netif *netif)
// ommitting a bit of setup here..
osThreadDef(EthIf, ethernetif_input, osPriorityRealtime, 0, INTERFACE_THREAD_STACK_SIZE);
osThreadCreate (osThread(EthIf), netif);
It looks as though the CMSIS macro "osThreadDef" expects the function to take an argument of type "const void *". However, in the "ethernetif_input" task, the argument is cast to a non const netif:
void ethernetif_input( void const * argument )
struct pbuf *p;
struct netif *netif = (struct netif *) argument;
// ommitting more here
I'm compiling this with arm-none-eabi-gcc, with full warnings on and it complains about "discards 'const' qualifier from pointer target type". I think this error is correct as we've told the compiler that the argument will be a const void *.
Looking a bit deeper it looks as though this problem stems from the cmsis_os where the "os_pthread" type is defined as below.
typedef void (*os_pthread) (void const *argument);
I'm a little bit lost about why the os_pthread is defined to accept a const void pointer, seeing as FreeRTOS doesn't require this. How are you supposed to pass arguments to tasks using the CMSIS library that aren't const data?
Obviously I can turn off warnings to solve this, but isn't this unsafe practice?