Can anyone guide me on porting FreeRTOS to STM32F411CEU6
@Umesh Lokhande sorry for mentioning. As you work with FreeRTOS a lot can you please guide me how should I can port one for my
STM32F411CEU6
37 Replies
I am currently facing issues regarding the ISR's
wait this is easy what are you struggling with?
so I was able go compile my program just fine but i think there is some issues related to porting
so when I try to start the scheduler it goes into hardfault
If you can compile code fine without any error that means you successfully ported FreeRTOS. For the second part of question, the issue could be anything from configuration parameters to code itself. As far as the issue with ISRs and scheduler. I think you need to provide more information about the exact error.
I was compiling the project making freeRTOS as a library but due to that it has some issues to find my ISR's needed for context switching so even the code was compiling fine when the scheduler starts it was looking for the first task with the help of and ISR since those ISR wasn't detected due to compiling freeRTOS as a library it went into hardfault
Okay happy it was fixed
The issue is fixed and also I have implemented own
printk
now it is ready to work on
FreeRTOS has some trace debug function
I have to deep dive a bit i think
Now that the basics are working, have you considered adding any additional features or optimizations to your project
Not yet I am trying to understand all the configuration in
FreeRTOSCOnfig.h
fileAfter that I can focus on optimization
can you please give me some basic idea where it can be optimized?
If so check if
configMAX_PRIORITIES
is set to an appropriate value based on how many priority levels your tasks need. Too many can waste resources, and too few can limit flexibilityAnd you can even use
configMINIMAL_STACK_SIZE
to keep task stack sizes minimal but still adequateJust avoid oversized stacks, that one can consume a lot of memory
it was 130 before but I was facing overlfow issue so I made it 255
You might be able to reduce stack overflow risk without increasing
configMAX_PRIORITIES
by adjusting individual task stack sizes. Try using uxTaskGetStackHighWaterMark()
to see each task’s actual stack usageIf any task is using more than expected, increase iits own specific stack size and there will be no overflow
I was using vsnprintf and stargs in printk i think for that also
those funciton's are quite memory hungry
Ah, that makes sense , that
vsnprintf
and similar functions can definitely use a lot of stack, especially with longer strings or complex formattingI limited it to 100 characters
There are still prolly ways to optimize memory usage
I thing that is more than enough to print some info at a time
Yeah let's explore a bit :excusemewhat:
Yh yh , that should help keep memory usage in check while still getting useful output
also using my ram usage is 62% out of 128KB i think that is due the heap region also right?
heap region is treated as occupied memory as far as i know
Exactly as you said . The heap wil take up part of the RAM, so any dynamically allocated memory adds to that usage
Keeping an eye on both stack and heap allocations can help manage overall memory use efficiently ✅
for sure I am gonna try that after a bit exploring the basics
That wil be great