Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeRTOSConfig.h should be a separate header #2

Open
jacquelinekay opened this issue Sep 13, 2016 · 2 comments
Open

FreeRTOSConfig.h should be a separate header #2

jacquelinekay opened this issue Sep 13, 2016 · 2 comments

Comments

@jacquelinekay
Copy link

First, thanks a lot for working on this project. It's so helpful to have a CMake-based buildsystem for the ARM/CMSIS/FreeRTOS! I haven't worked much with other stacks but it's cool to know that I could use this if I wanted to.

The FreeRTOS application doesn't compile for the Arm Cortex M7 target out of the box because configMAX_SYSCALL_INTERRUPT_PRIORITY doesn't get set. I noticed that this gets set in board.h for the ARMCM4 target but not the M7. The way this is done in the ST Cube framework is by the application providing a separate FreeRTOSConfig.h header. What do you think of this pattern? It seems cleaner to me. For now I just throw the definition of the missing settings into board.h to be consistent with the other target as a workaround.

@oliviermartin
Copy link
Contributor

The reason I did not do it for the other ARM Cortex-M was I have not spent much time thinking about the correct definitions for the other ones. But I agree it is not elegant.

Another approach would be to add a new CMake variable like RTOS_MAX_SYSCALL_INTERRUPT_PRIORITY to the current list here: https://github.com/labapart/polymcu#rtos-variables

And add this definition to the existing RTOS/FreeRTOS/include/FreeRTOSConfig.h.in like that:

/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY    5

/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#cmakedefine RTOS_MAX_SYSCALL_INTERRUPT_PRIORITY
#ifdef RTOS_MAX_SYSCALL_INTERRUPT_PRIORITY
  #define configMAX_SYSCALL_INTERRUPT_PRIORITY @RTOS_MAX_SYSCALL_INTERRUPT_PRIORITY@
#else
  #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - __NVIC_PRIO_BITS) )
#endif

What do you think?

@jacquelinekay
Copy link
Author

That seems like a good solution to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants