Create CubeMX project with STM32F429 Discovery
In NVIC set prioryti of System tick timer and Generate Code in MDK v5
Open project in Keil (ver 5.18)
In Manage Run-Time Environment set Keil RTX
After compilling
linking...
cube\cube.axf: Error: L6200E: Symbol SysTick_Handler multiply defined (by hal_cm4.o and stm32f4xx_it.o).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 1 error messages.
"cube\cube.axf" - 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:08
Comment SysTick_Handler:
/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles System tick timer.
*/
//void SysTick_Handler(void)
//{
// /* USER CODE BEGIN SysTick_IRQn 0 */
// /* USER CODE END SysTick_IRQn 0 */
// HAL_IncTick();
// HAL_SYSTICK_IRQHandler();
// /* USER CODE BEGIN SysTick_IRQn 1 */
// /* USER CODE END SysTick_IRQn 1 */
//}
Add code to main.c
In NVIC set prioryti of System tick timer and Generate Code in MDK v5
Open project in Keil (ver 5.18)
In Manage Run-Time Environment set Keil RTX
When checked Keil RTX and do not mention on yellow and Validation Output
After compilling
linking...
cube\cube.axf: Error: L6200E: Symbol SysTick_Handler multiply defined (by hal_cm4.o and stm32f4xx_it.o).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 1 error messages.
"cube\cube.axf" - 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:08
Comment SysTick_Handler:
/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles System tick timer.
*/
//void SysTick_Handler(void)
//{
// /* USER CODE BEGIN SysTick_IRQn 0 */
// /* USER CODE END SysTick_IRQn 0 */
// HAL_IncTick();
// HAL_SYSTICK_IRQHandler();
// /* USER CODE BEGIN SysTick_IRQn 1 */
// /* USER CODE END SysTick_IRQn 1 */
//}
Add code to main.c
:
/* USER CODE BEGIN Includes */
#include "cmsis_os.h" // ARM::CMSIS:RTOS:Keil RTX
/* USER CODE END Includes */
:
/* USER CODE BEGIN 0 */
extern uint32_t os_time;
uint32_t HAL_GetTick(void) { // Add HAL_GetTick function for STM32Cube HAL
return os_time;
}
/* USER CODE END 0 */
:
int main(void)
{
:
/* USER CODE BEGIN 1 */
osKernelInitialize (); // Initialize RTOS Kernel for setup
/* USER CODE END 1 */
:
/* USER CODE BEGIN 2 */
osKernelStart (); // Begin thread switching
/* USER CODE END 2 */
:
Thank You very much!
ОтветитьУдалитьThis worked perfectly on an F3 part. This is a much cleaner and faster way to add RTX to a CubeMX project than the way Keil would have you do it using the RTE - which only works for certain parts like the F2 and F4.
One note... In CubeMX, I have quite a few default interrupts that can not be disabled, they are mostly enabled and cannot be changed. Besides SysTick I had to also comment out SVC_Handler and PendSV in the _it.c file. Perhaps this could be fixed using the next tab over on the NVIC page, the Code Generation tab?
Thanks again.
Try Configuration->NVIC Configuration->Code generition
ОтветитьУдалитьHi,
ОтветитьУдалитьhow it works with RTX5 ?
thanks
as well as with RTX
ОтветитьУдалитьmark RTX5 instead RTX (last picture)
dosen't work! Did you have test it?
ОтветитьУдалить