cancel
Showing results for 
Search instead for 
Did you mean: 

UART Receiving Interrupt while using FreeRTOS/CMSIS V2

IvanOrot
Associate III

When I try to set up a HAL_UART_Receive_IT my program won't compile.

I am new to the FreeRTOS concept, but it is necessary for me to learn how to set it up for a project I am working on. For that, I started restructuring a previous project to learn from the process. I stumbled with the problem of me not knowing how to setup a UART interrupt when using tasks. I tried reading online on how to do it. This is what I have done so far:

  • In my .ioc file I enable FreeRTOS using CMSIS V2
  • Using the .ioc configurations I enabled
    • four tasks with the same priority
    • two queues
    • one Semaphore
    • one Mutex
  • I enable UARTS 1,2 and 3
    • I enabled global interrupts for all the UARTS

I tested tasks by making a LED blink. But when I tried to set up a HAL_UART_Receive_IT my program wouldn't compile. My guess is that I have a bad case of I-am-a-rookie. But I tried this:

  • I tried calling the function from the main() setup before the osKernelStart() instruction, but it failed. 
  • I tried calling it inside one of the tasks but it failed. I used both a buffer defined globally and a buffer defined locally in the task(I knew that one would fail).

Normally the IDE does a great job at guiding me whenever there is a bug or outlines where I made a syntax mistake. Right now, it does nothing. It fails to compile. It works again when I erase the HAL_UART_Receive_IT(), though. Where should I call this function? What do I need to set up UART reception using FreeRTOS(CMSIS V2)? I know I have to pass the received message through a queue, but I have not being able to compile the code, yet.

P.S. I get a message saying I did not enabled the USE_NEWLIB_REENTRANT, is that important? I read the description but it doesn't sound like something I need at the moment.

1 ACCEPTED SOLUTION

Accepted Solutions

Yes, FLASH is full. Assuming the size of FLASH is defined correctly in the linker file (*.ld), you'll have to reduce the size of your code somehow.

Setting the Build Configuration to Release instead of Debug can shave off a significant amount and increase speed at the expensive of some debugging functionality.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

> Right now, it does nothing. It fails to compile.

When you try to compile, and it fails to compile, error messages are output to the Console tab. Scroll up to the top and look at the first or first few error messages in the Console tab and you will get an error message the describes why it doesn't compile. (Do not look at the Problems tab.)

If you can't figure it out, show those error messages in full here.

If you feel a post has answered your question, please click "Accept as Solution".
/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: Project_RTOS_v2.0.elf section `.text' will not fit in region `FLASH'

/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 3076 bytes

make: *** [makefile:92: Project_RTOS_v2.0.elf] Error 1

14:26:24 Build Failed. 3 errors, 0 warnings. (took 1s.745ms)

I got these error. Is the flash memory full? I haven't even added any complex code to the program.

Yes, FLASH is full. Assuming the size of FLASH is defined correctly in the linker file (*.ld), you'll have to reduce the size of your code somehow.

Setting the Build Configuration to Release instead of Debug can shave off a significant amount and increase speed at the expensive of some debugging functionality.

If you feel a post has answered your question, please click "Accept as Solution".

It worked!
Thank you!