2025-02-04 12:17 AM
Hi,
I am using an STM32G0B1CBT and using the example shown in the following video to implement a USB-C PD sink with TRACER_EMB and UI_INTERFACE utilities for debugging.
https://www.youtube.com/watch?v=-vsJhNIaHxE
After compiling and running the code, I noticed that the function BSP_GUI_LoadDataFromFlash at line 80 is trying to read from flash address 0x803F800, which is outside the memory region of 128k for the STM32G0B1CBT MCU.
What can be the issue?
Thanks
2025-02-05 05:09 AM
Hi @DDeba.1
It is possible GUI interface is intended for application with more flash footprint. So, BSP provided is not dependent on the target, users should implement appropriate boundary checks in their code to prevent accessing invalid memory regions. Also, it is possible to customize and optimize your code.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-02-06 12:09 AM
Hi @FBL ,
I generated the code using the STM32CubeMX after selecting the proper device part number (STM32G0B1CBT). The GUI Interface and TRACER_EBM where both greyed out at first. After enabling USART1, the TRACER_EBM became available to use. Than after enabling the tracer on the USB PD, the GUI INTERFACE became available to use. In such case, I would expect that the code is generated according to the selected device .Moreover, the address from which the function is trying to read is define in a macro called GUI_FLASH_MAGIC_NUMBER. After following this macro, I see that this is defined through a number of other macros found in smt32g0xx_hal_flash.h which is also generated by the STM32CubeMX.
Any idea of why the STM32CubeMX would generate wring values in these files? Is this a bug? Or at least, is there a way I can go around it to debug my application?
Thanks
2025-02-07 03:26 AM
Hi @DDeba.1
First, check size of your code! it is not expected to see writing outside the Flash, the linker should not allow it.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-02-07 04:11 AM
Hi @FBL,
Code size is 89.8kB (70.16% of 128K). I checked the linker and the flash size is correctly defined as 128K. I have attached the code in case someone wants to give a deeper check (its a simple USB-C PD app generated by the CubeMX).