Hey all,
I am programming Arduino portenta with STM32CubeIDE. Everything is okey when I debugging with STM32CubeIDE. My leds are blinking my Usart is okey, I can see "Hello" on serial. And I can debugging again and again it works normally. But when I plug off and plug on arduino, I cant debug Portenta anymore and Orange Led turns on. I have to connect MCU with STLink Utility with connect under reset and erase full chip flash memory then I have to burn bootloader on ArduinoIDE to use portenta again.
So I return to beginning all time when I plug off Arduino.
Can anyone help me please ?
Best regards.
Is there anyone have an idea ?
Seeing that your question did not attract the attention of those who might be in the know, your topic has been moved to the dedicated Portenta section of the forum.
It's pretty common, here is how I dealt with the same problem: Portenta H7 bricked - Hardware / Portenta - Arduino Forum . Basically, the STM32CubeIDE only knows about the MCU not about the PMIC that powers it - for that you need the BSP that Arduino provides including the boot ROM that configures it. When you overwrite the Arduino boot ROM each time when downloading code, the MCU does not get 3.3V but 0.17V.
I want to start a new thread with using STM32CubeIDE for Portenta:
Not so easy...
Just make sure:
-
never write code and flash it, when it would overwrite address in Flash 0x08000000...0x0803FFFF!
-
Your own code, your sketch, starts at 0x08040000!
Do NOT TOUCH any content in Flash ROM before this region!
It seems to work to create an STM32CubeIDE project - if you make sure to have such a linker script (linker_script.ld):
/* Memories definition */
MEMORY
{
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x08040000, LENGTH = 2048K - 0x40000 /* Memory is divided. Actual start is 0x08000000 and actual length is 2048K */
Please, see this 0x08040000! It seems to work fine: the debugger session does not seem to "erase all" from ROM flash (0x08000000...0x0803FFFF must stay there!).
It is not so easy to create a Sketch project with STM32CubeIDE (e.g. vector table, startup code, interrupt vector setup, PMIC config, clock config) - but possible (I am making progress).
If you bootloader is gone:
-
you need an external SDW debugger
-
flash the bootloader again (hopefully the PMIC is not unconfigured and you can connect debugger)
First off all, Thank you guys for your reply. You really help me to figure out this problem a little bit.
/* Memories definition */
MEMORY
{
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x08040000, LENGTH = 2048K - 0x40000 /* Memory is divided. Actual start is 0x08000000 and actual length is 2048K */
@tjaekel I have a linker file in M7 and M4 core STM32H747XIHX_FLASH.Id and I changed M7 core FLASH(rx) like you said but my debugger got errors and does not run. When use actual adress FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K it backs to normal.
I tired to try figure this out ![]()
I added the debug error when I changed flash adrdess.

Hmmm, no real idea.
I assume, your project has its own vector table. And the first entry is the SP address (for your FW).
Check, when flashed to 0x08040000 - if you see a reasonable vector table, with SP, Reset_Handler, ... addresses.
It is important to have it in your code, another vector table at 0x08040000: the bootloader checks it, e.g. if first entry for SP is a reasonable RAM address.
Actually, when you build it for 0x08000000 - there must be a vector table, also a Reset_Handler etc.
I can only imagine: this "magic" number used in bootloader kicks in (e.g. DFU, OTA and nothing to flash), or bootloader has a key verification.
It looks to me as: bootloader cannot proceed, something wrong, and a BKPT instruction is there in bootloader to stop processing.
My five cents:
make sure, you have a vector table, SP set properly, a startup.S, a Reset_Handler etc. (like you would need for a full project).
BTW: did you flash the bootloader back?
(or did you left the system after flashing your project at 0x08000000 as left - and no bootloader there?)
Here is my project (simple RTOS CMSIS 2 with blinking green LED, using SysTick for osDelay() ):
CubeIDE project (blinking LED) on Portenta H7 with bootloader