I believe I have followed the steps to integrate FreeRTOS into my STM32F4 project, but getting a link error.
I modified the startup file for EWARM (IAR) and added the declarations there:
EXTERN xPortPendSVHandler
EXTERN xPortSysTickHandler
EXTERN vPortSVCHandler
Also change further below in the __vector_table:
DCD vPortSVCHandler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD 0 ; Reserved
DCD xPortPendSVHandler ; PendSV Handler
DCD xPortSysTickHandler ; SysTick Handler
I have the file “FreeRTOSConfig.h” in my local include directory and it’s in the compiler’s preprocessor path. Still, I get this link error:
Error[Li005]: no definition for “vPortSVCHandler” [referenced from C:\Users\rds\Documents\IAR Embedded Workbench\ADC2\Projects\EWARM\ADC2 Configuration\Obj\startup_stm32f407xx.o]
The other option would be to keep the linker script exactly as delivered by IAR, then add the following lines into FreeRTOSConfig.h to effectively change the names of the FreeRTOS handlers:
In my assembler, I have to use an assembly directive ‘XREF’ to cast a variable as public. They are private by default. Also, my C/ASM environment use different variable names as seen by the linker. All C variable have an underscore ‘_’ before the name. So, if I want to use an assembly variable or function from C I have to name it in assembly starting with an underscore and drop it in the C code.
Hi,
Thanks for the help. Richard, your suggestion worked and it now compiles and links correctly.
Now a further question regarding systick. In my code, I had a basic ADC configuration in a loop reading an input, which was working OK.
Now, I’ve added in (under IAR) the FreeRTOS 8 folder and all required files, and it builds OK. I still have the same main.c file, of which I’ve included:
But I have NOT actually added any FreeRTOS tasks, statements or variables. However, it appears the basic ADC operation is no longer working correctly. I had a simple for loop running the ADC 50 times in the call “HAL_ADC_PollForConversion”, which was previously working fine. Now, it now runs exactly 3 times and then freezes (I havea printf stament in the loop). I don’t want to yet add a task or start the scheduler until I understand what is now happening.
Any suggestions as to what has happened, and why the ADC is behaving this way, especially without any FreeRTOS operating code yet added?
I’ve figured out where the problem is…there isn’t. It’s now working OK.
For whatever reason (maybe someone can explain why) that, until I placed the reading of the adc withing a task and launched the scheduler, it doesn’t operate correctly. I suspect this has something to do with systick?