cancel
Showing results for 
Search instead for 
Did you mean: 

Could some expert on STM32F4 series explain the meaning of the following message on my CubeIDE Debugger Console. It was all fine till now, suddenly, this error and program aborts

NAnand1
Associate III

Note: automatically using hardware breakpoints for read-only addresses.

set *(int *)0xE000EDFC=*(int *)0xE000EDFC|0x7F0

Program received signal SIGTRAP, Trace/breakpoint trap.

0xfceaf000 in ?? ()

8 REPLIES 8
Bob S
Principal

What register are you trying to modify? That address (0xe000edfc) does not appear in the ST CortexM4 programmer's manual (PM0214), at least that I can find. That is in the "not defined" region between the MPU and NVIC, and not one of the FPU registers.

And where did the "0xfceaf000" value come from? Perhaps real screen shots of the error?

Fladek
Associate II

Hey @NAnand1,

I am having pretty much the same error, just the last line is 

0xf3af4804 in ?? ()

 for me.

 

Did you find any fix or workaround for this error?

Alex2968
Associate II

same here, any solution?

Yeah - debug your code.  Look at the stack when that happens.  Where did the CPU come from (what is the last "real" function that shows up in the stack trace window)?  What is the SP value? 

These kind of errors are usually a stack overflow or corrupted memory issue.  Sometimes floating BOOT0 pin can cause funky behavior, though I'm not sure THIS kind of behavior.

I'm going with unstacking some junk

Probably look for ridiculous auto/local allocations within a function, or compound statement scopes.

Errant pointers, DMA into a auto/local buffer scope that's already collapsed...

Do the debuggering thing, perhaps instrument, and stack-check..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hello Bob, im trying to port FreeRTOS to my STM32F767ZI board. Im doing a blinking example, setting up 2 tasks, one for the blinking the blue led and another for the red led on my board.

The main.c code looks as follows:

#include "main.h"

#include "FreeRTOS.h"

#include"task.h"

 

TaskHandle_t xRedLEDTaskHandle;

TaskHandle_t xBlueLEDTaskHandle;

 

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

/* USER CODE BEGIN PFP */

void vRedLEDTask(void *pvParameters);

void vBlueLEDTask(void *pvParameters);

 

int main(void)

{

HAL_Init();

SystemClock_Config();

MX_GPIO_Init();

/* USER CODE BEGIN 2 */

xTaskCreate(vRedLEDTask, "RED LED", 128, NULL, 1, &xRedLEDTaskHandle);

xTaskCreate(vBlueLEDTask, "Blue LED", 128, NULL, 1, &xBlueLEDTaskHandle);

vTaskStartScheduler();

/* USER CODE END 2 */

while (1)

{

 

}

 

 

void SystemClock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct = {0};

RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

 

__HAL_RCC_PWR_CLK_ENABLE();

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

 

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

RCC_OscInitStruct.HSIState = RCC_HSI_ON;

RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

RCC_OscInitStruct.PLL.PLLM = 8;

RCC_OscInitStruct.PLL.PLLN = 216;

RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

RCC_OscInitStruct.PLL.PLLQ = 2;

RCC_OscInitStruct.PLL.PLLR = 2;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

{

Error_Handler();

}

 

if (HAL_PWREx_EnableOverDrive() != HAL_OK)

{

Error_Handler();

}

 

RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;

RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

 

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)

{

Error_Handler();

}

}

static void MX_GPIO_Init(void)

{

GPIO_InitTypeDef GPIO_InitStruct = {0};

 

/* GPIO Ports Clock Enable */

__HAL_RCC_GPIOB_CLK_ENABLE();

__HAL_RCC_GPIOA_CLK_ENABLE();

 

/*Configure GPIO pin Output Level */

HAL_GPIO_WritePin(GPIOB, red_led_Pin|blue_led_Pin, GPIO_PIN_RESET);

 

/*Configure GPIO pins : red_led_Pin blue_led_Pin */

GPIO_InitStruct.Pin = red_led_Pin|blue_led_Pin;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

 

}

 

/* USER CODE BEGIN 4 */

void vRedLEDTask(void *pvParameters){

for(;;){

HAL_GPIO_TogglePin(red_led_GPIO_Port, red_led_Pin);

HAL_Delay(500);

}

}

void vBlueLEDTask(void *pvParameters){

for(;;){

HAL_GPIO_TogglePin(blue_led_GPIO_Port, blue_led_Pin);

HAL_Delay(500);

}

}

/* USER CODE END 4 */

 

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

{

/* USER CODE BEGIN Callback 0 */

 

/* USER CODE END Callback 0 */

if (htim->Instance == TIM1) {

HAL_IncTick();

}

/* USER CODE BEGIN Callback 1 */

 

/* USER CODE END Callback 1 */

}

 

void Error_Handler(void)

{

/* USER CODE BEGIN Error_Handler_Debug */

/* User can add his own implementation to report the HAL error return state */

__disable_irq();

while (1)

{

}

/* USER CODE END Error_Handler_Debug */

}

 

#ifdef USE_FULL_ASSERT

void assert_failed(uint8_t *file, uint32_t line)

{

/* USER CODE BEGIN 6 */

/* User can add his own implementation to report the file name and line number,

ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

/* USER CODE END 6 */

}

#endif /* USE_FULL_ASSERT */

 

my FreeTRTOSconfig.h:

#ifndef FREERTOS_CONFIG_H

#define FREERTOS_CONFIG_H

 

/* Ensure stdint is only used by the compiler, and not the assembler. */

#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)

#include <stdint.h>

extern uint32_t SystemCoreClock;

#endif

 

 

#define configUSE_PREEMPTION 1

#define configUSE_IDLE_HOOK 0

#define configUSE_TICK_HOOK 0

#define configCPU_CLOCK_HZ ( SystemCoreClock )

#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )

#define configMAX_PRIORITIES ( 7 )

#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )

#if defined(__GNUC__)

#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 25 * 1024 ) )

#else

#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 20 * 1024 ) )

#endif

#define configMAX_TASK_NAME_LEN ( 16 )

#define configUSE_TRACE_FACILITY 1

#define configUSE_16_BIT_TICKS 0

#define configIDLE_SHOULD_YIELD 1

#define configUSE_MUTEXES 1

#define configQUEUE_REGISTRY_SIZE 8

#define configCHECK_FOR_STACK_OVERFLOW 0

#define configUSE_RECURSIVE_MUTEXES 1

#define configUSE_MALLOC_FAILED_HOOK 0

#define configUSE_APPLICATION_TASK_TAG 0

#define configUSE_COUNTING_SEMAPHORES 1

#define configGENERATE_RUN_TIME_STATS 0

#define configUSE_STATS_FORMATTING_FUNCTIONS 1

#define configSUPPORT_DYNAMIC_ALLOCATION 1

 

 

/* Co-routine definitions. */

#define configUSE_CO_ROUTINES 0

#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

 

/* Software timer definitions. */

#define configUSE_TIMERS 0

#define configTIMER_TASK_PRIORITY ( 2 )

#define configTIMER_QUEUE_LENGTH 10

#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )

 

/* Set the following definitions to 1 to include the API function, or zero

to exclude the API function. */

#define INCLUDE_vTaskPrioritySet 1

#define INCLUDE_uxTaskPriorityGet 1

#define INCLUDE_vTaskDelete 1

#define INCLUDE_vTaskCleanUpResources 0

#define INCLUDE_vTaskSuspend 0

#define INCLUDE_vTaskDelayUntil 0

#define INCLUDE_vTaskDelay 1

#define INCLUDE_xTaskGetSchedulerState 1

 

/* Cortex-M specific definitions. */

#ifdef __NVIC_PRIO_BITS

/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */

#define configPRIO_BITS __NVIC_PRIO_BITS

#else

#define configPRIO_BITS 4 /* 15 priority levels */

#endif

 

#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf

 

#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5

 

#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

 

#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

 

#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }

 

#define vPortSVCHandler SVC_Handler

#define xPortPendSVHandler PendSV_Handler

 

#endif /* FREERTOS_CONFIG_H */

 

my register when breakpoint was hit and the error appeared:

Alex2968_0-1709886924328.png

 

 

 

 The error in debugger console:

 

Note: automatically using hardware breakpoints for read-only addresses.

set *(int *)0xE000EDFC=*(int *)0xE000EDFC|0x7F0

Breakpoint 1, main () at ../Core/Src/main.c:77

77 HAL_Init();

 

 

Any thoughts you could share with me?

Thank you.

 

 

Ok, It´s solved, it was an stack overflow error as you said before. the funcion used a lot of memory, I changed this:

#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128) to

#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 512)

 

and it works perfectly. Thank you very much for the help.

Fladek
Associate II

Thanks guys, I also just found my problem.

 

For some reason after generating code, either from TouchGFXDesigner or from CubeMX my root Folder is removed from the Source Locations, leading to this strange error message.

So, adding it back manually in the project properties resolved the issue.