2025-07-16 11:42 AM - edited 2025-07-16 2:13 PM
I am developing software on the Nucleo-L433RC-P board but have a strange situation when debugging.
The first time I debug, the software does not run and I get the following error...
Break at address "0x1fff2ce8" with no debug information available, or outside of program code.
Break at address "0x1fff2cd6" with no debug information available, or outside of program code.
As shown in the screenshot below...
However, the second time I debug it works correctly.
Why does it not work correctly on the first debug, but then works correctly on the second debug ?
I have tried two different boards (one of which is brand new and never been used) but the behaviour is the same, so it must be a software issue.
2025-07-16 1:23 PM
That's from the ROM, so either the BOOT0 is HIGH, or the FLASH is blank and doesn't contain viable vector table, so goes to ROM code instead.
2025-07-16 2:03 PM - edited 2025-07-16 2:11 PM
BOOT0 is pulled low via a 10k resistor on this board and the pin on the header is floating
why would the flash be blank when I debug ?
2025-07-16 2:11 PM - edited 2025-07-16 2:16 PM
Well, depends on the sequencing, but if you erase, and reset, this determination may be sticky and require a power-cycle to clear on some STM32 parts. Relates to how it latches option bytes, and protects against code recovery attacks.
You'd want to look at the connection options chosen in the programmer.
The debugger might be resetting to gain control of the part, or to get a clear start.
The key take-away is that it's running code from ROM rather than FLASH, and has no source code to associate to that.
You could perhaps try a different debugger, or check firmware version in ST-LINK
2025-07-16 2:18 PM
I've tried "Software system reset" and "Connect under reset" options, but it made no difference.
One of the boards I tested was brand new (never been used).
The only thing I can think of is that my software uses the blue top button for shutdown and wakeup (using SYS_WKUP2). Could this be a problem ?
2025-07-16 2:58 PM - edited 2025-07-16 3:00 PM
When I plugged the new board in the firmware for the stlink did an update to the latest version
I just click the debug button.In STM32CubeIDE, I don’t manually erase
Could it be a bug in the stlink firmware?
This problem occurs on two different boards and one is brand new
2025-07-16 3:23 PM
Not sure if it matters if the boards are new, or not
There are boot setting in the Option Bytes, and it checks for 0xFFFFFFFF patterns in the vector table.
Does your code work reliably out of a power cycle? That's the primary thing to worry about.
When the debugger is erasing, resetting and break-pointing it could well trigger annoying behaviours in the part and it's protection methods. Not sure I'd spend too much time fighting these shadows. You could make a boot loader that gates access to an application firmware you develop deeper into the FLASH, and then the block/sector at 0x08000000 wouldn't need to get erased in your crash-n-burn debug cycle.
2025-07-17 11:19 AM
I have attached my project (Software.zip) and hoping someone could have a look to see whats causing this please?
It only happens with my project, so there is something wrong with it.
If I step through the code from the first line in main, which starts with "HAL_Init();" and step line by line to the while(1) loop, it works correctly every time.
However, if I resume (F8) from the start of the code then this issue occurs, where after each debug flash it alternately fails and goes to ROM or works correctly.
I dont have confidence in developing my software futher as Im concerned this problem could be causing other problems.
I am currently trying to implement shutdown, but for now I have commented out the call to shutdown.
Thanks in advance
2025-07-19 5:01 AM - edited 2025-07-19 5:21 AM
I have found where the problem is occuring, but dont know why.
Once I have flashed the device and step through the code, it fails (alterntately) on the function 'w25qxx_init' which initialises the external flash device (W25Q128)...
w25qxx_init(&w25qxx, &hspi2, GPIOB, GPIO_PIN_6);
This is the function...
#ifdef W25QXX_QSPI
W25QXX_result_t w25qxx_init(W25QXX_HandleTypeDef *w25qxx, QSPI_HandleTypeDef *qhspi) {
#else
W25QXX_result_t w25qxx_init(W25QXX_HandleTypeDef *w25qxx, SPI_HandleTypeDef *hspi, GPIO_TypeDef *cs_port, uint16_t cs_pin) {
#endif
W25QXX_result_t result = W25QXX_Ok;
W25_DBG("w25qxx_init");
char *version_buffer = malloc(strlen(W25QXX_VERSION) + 1);
if (version_buffer) {
sprintf(version_buffer, "%s", W25QXX_VERSION);
free(version_buffer);
}
#ifdef W25QXX_QSPI
w25qxx->qspiHandle = qhspi;
#else
w25qxx->spiHandle = hspi;
w25qxx->cs_port = cs_port;
w25qxx->cs_pin = cs_pin;
cs_off(w25qxx);
#endif
uint32_t id = w25qxx_read_id(w25qxx);
if (id) {
w25qxx->manufacturer_id = (uint8_t) (id >> 16);
w25qxx->device_id = (uint16_t) (id & 0xFFFF);
switch (w25qxx->manufacturer_id) {
case W25QXX_MANUFACTURER_GIGADEVICE:
w25qxx->block_size = 0x10000;
w25qxx->sector_size = 0x1000;
w25qxx->sectors_in_block = 0x10;
w25qxx->page_size = 0x100;
w25qxx->pages_in_sector = 0x10;
switch (w25qxx->device_id) {
case 0x6017:
w25qxx->block_count = 0x80;
break;
default:
W25_DBG("Unknown Giga Device device");
result = W25QXX_Err;
}
break;
case W25QXX_MANUFACTURER_WINBOND:
w25qxx->block_size = 0x10000;
w25qxx->sector_size = 0x1000;
w25qxx->sectors_in_block = 0x10;
w25qxx->page_size = 0x100;
w25qxx->pages_in_sector = 0x10;
switch (w25qxx->device_id) {
case 0x4018:
w25qxx->block_count = 0x100;
break;
case 0x4017:
w25qxx->block_count = 0x80;
break;
case 0x4016:
w25qxx->block_count = 0x40;
break;
default:
W25_DBG("Unknown Winbond device");
result = W25QXX_Err;
}
break;
default:
W25_DBG("Unknown manufacturer");
result = W25QXX_Err;
}
} else {
result = W25QXX_Err;
}
if (result == W25QXX_Err) {
// Zero the handle so it is clear initialization failed!
memset(w25qxx, 0, sizeof(W25QXX_HandleTypeDef));
}
return result;
}
When I step through the 'w25qxx_init' function, it fails on this line....
char *version_buffer = malloc(strlen(W25QXX_VERSION) + 1);
This never used to happen in the early stages of development, I have added further code and peripherals since then so don't know why w25qxx_init would suddenly cause this issue ?
2025-07-19 6:02 AM
So you think this is an issue with the string library or the dynamic memory allocation?
Fails How? Hard Faults or loops somewhere else?
Is this code necessary? You're not outputting the message, and creating a strmalloc() type function with malloc/strcpy might be more efficient