cancel
Showing results for 
Search instead for 
Did you mean: 

Flashing empty memory pages with cubemx locks my mcu

Javier1
Principal

Good evening stm32 dwellings, i have a flash problem.

I find myself with the need to write a config file independent to my programm code.

In order to do that my programm uses pointers to specific memory pages of my stm32f105:

define ADDR_FLASH_PAGE_54    ((uint32_t)0x0801B000) /* Base @ of Page 54, 2 Kbytes */
#define ADDR_FLASH_PAGE_55    ((uint32_t)0x0801B800) /* Base @ of Page 55, 2 Kbytes */

For debugging purposes i created a temporal setup function that writes the a hardcoded config structure directly to my flash. (<- this is working fine, reading and writting)

BUT

Once i build my own configFile.bin and try to flash it with stm32cubeMX i get this:

 0693W000007EwP0QAK.png 

the flashed data looks fine when i read the memory, but the mcu is locked, once i start a debugging session it goes into hardfault at random moments.

this is the verbosity output of the stm32cubeMX flashing

I have no idea of what is going on....

16:38:55:746 : Memory Programming ...
  16:38:55:756 : Opening and parsing file: archivobinario_pointerArray.bin
  16:38:55:757 :   File          : archivobinario_pointerArray.bin
  16:38:55:757 :   Size          : 120 Bytes
  16:38:55:757 :   Address       : 0x0801B000 
  16:38:55:757 : Erasing Segment <0> Address <0x0801B000> Size <120>Bytes
  16:38:55:758 : Erasing memory corresponding to segment 0:
  16:38:55:760 : Memory erase...
  16:38:55:760 : halt ap 0 
  16:38:55:760 : w ap 0 reg 15 PC   (0x20000000)  
  16:38:55:760 : w ap 0 reg 17 MSP  (0x20000500)  
  16:38:55:760 : w ap 0 reg 16 xPSR (0x01000000)  
  16:38:55:763 : w ap 0 @0x20000960 0x00000200 bytes Data 0x00000000
  16:38:55:767 : w ap 0 @0x20000000 0x00000004 bytes Data 0x0000BE00
  16:38:55:783 : w ap 0 @0x20000004 0x0000053E bytes Data 0xF000B580
  16:38:55:790 : Erasing internal memory sector 54
  16:38:55:791 : Init flashloader...
  16:38:55:792 : halt ap 0 
  16:38:55:792 : w ap 0 reg 0 R0   0x00000001
  16:38:55:793 : w ap 0 reg 1 R1   0x00000000
  16:38:55:793 : w ap 0 reg 2 R2   0x00000000
  16:38:55:793 : w ap 0 reg 3 R3   0x00000000
  16:38:55:793 : w ap 0 reg 4 R4   0x00000000
  16:38:55:794 : w ap 0 reg 5 R5   0x00000000
  16:38:55:795 : w ap 0 reg 6 R6   0x00000000
  16:38:55:795 : w ap 0 reg 7 R7   0x00000000
  16:38:55:795 : w ap 0 reg 8 R8   0x00000000
  16:38:55:796 : w ap 0 reg 9 R9   0x00000000
  16:38:55:797 : w ap 0 reg 10 R10  0x00000000
  16:38:55:798 : w ap 0 reg 11 R11  0x00000000
  16:38:55:799 : w ap 0 reg 12 R12  0x00000000
  16:38:55:804 : w ap 0 reg 13 SP   0x00000000
  16:38:55:805 : w ap 0 reg 14 LR   0x20000001
  16:38:55:805 : w ap 0 reg 15 PC   0x20000005
  16:38:55:805 : w ap 0 reg 16 xPSR 0x01000000
  16:38:55:805 : w ap 0 reg 17 MSP  0x2000093E
  16:38:55:805 : w ap 0 reg 18 PSP  0x00000000
  16:38:55:805 : run ap 0 
  16:38:55:806 : halt ap 0 
  16:38:55:806 : r ap 0 reg 0 R0   0x00000001
  16:38:55:806 : Loader sector erase...
  16:38:55:806 : w ap 0 reg 0 R0   0x0801B000
  16:38:55:806 : w ap 0 reg 1 R1   0x0801B000
  16:38:55:808 : w ap 0 reg 2 R2   0x00000002
  16:38:55:808 : w ap 0 reg 3 R3   0x00000000
  16:38:55:808 : w ap 0 reg 4 R4   0x00000000
  16:38:55:808 : w ap 0 reg 5 R5   0x00000000
  16:38:55:808 : w ap 0 reg 6 R6   0x00000000
  16:38:55:808 : w ap 0 reg 7 R7   0x00000000
  16:38:55:808 : w ap 0 reg 8 R8   0x00000000
  16:38:55:808 : w ap 0 reg 9 R9   0x00000000
  16:38:55:809 : w ap 0 reg 10 R10  0x00000000
  16:38:55:809 : w ap 0 reg 11 R11  0x00000000
  16:38:55:809 : w ap 0 reg 12 R12  0x00000000
  16:38:55:809 : w ap 0 reg 13 SP   0x00000000
  16:38:55:809 : w ap 0 reg 14 LR   0x20000001
  16:38:55:810 : w ap 0 reg 15 PC   0x200001AF
  16:38:55:812 : w ap 0 reg 16 xPSR 0x01000000
  16:38:55:812 : w ap 0 reg 17 MSP  0x2000093E
  16:38:55:813 : w ap 0 reg 18 PSP  0x00000000
  16:38:55:813 : run ap 0 
  16:38:55:868 : halt ap 0 
  16:38:55:868 : r ap 0 reg 0 R0   0x00000001
  16:38:55:868 : erase: 0069ms
  16:38:55:869 : Download in Progress:
  16:38:55:869 :   Size          : 120 Bytes
  16:38:55:869 :   Address       : 0x0801B000 
  16:38:55:869 : Buffer program...
  16:38:55:870 : halt ap 0 
  16:38:55:870 : w ap 0 reg 15 PC   (0x20000000)  
  16:38:55:870 : w ap 0 reg 17 MSP  (0x20000500)  
  16:38:55:870 : w ap 0 reg 16 xPSR (0x01000000)  
  16:38:55:871 : w ap 0 @0x20000960 0x00000200 bytes Data 0x00000000
  16:38:55:871 : w ap 0 @0x20000000 0x00000004 bytes Data 0x0000BE00
  16:38:55:877 : w ap 0 @0x20000004 0x0000053E bytes Data 0xF000B580
  16:38:55:877 : Loader write range...
  16:38:55:878 : w ap 0 @0x20000960 0x0000003C bytes Data 0x0801B800
  16:38:55:878 : W B1 in RAM @0x20000960 size 0x0000003C : 0002ms
  16:38:55:878 : Init flashloader...
  16:38:55:878 : halt ap 0 
  16:38:55:878 : w ap 0 reg 0 R0   0x00000001
  16:38:55:878 : w ap 0 reg 1 R1   0x00000000
  16:38:55:879 : w ap 0 reg 2 R2   0x00000000
  16:38:55:879 : w ap 0 reg 3 R3   0x00000000
  16:38:55:879 : w ap 0 reg 4 R4   0x00000000
  16:38:55:879 : w ap 0 reg 5 R5   0x00000000
  16:38:55:879 : w ap 0 reg 6 R6   0x00000000
  16:38:55:879 : w ap 0 reg 7 R7   0x00000000
  16:38:55:879 : w ap 0 reg 8 R8   0x00000000
  16:38:55:879 : w ap 0 reg 9 R9   0x00000000
  16:38:55:880 : w ap 0 reg 10 R10  0x00000000
  16:38:55:880 : w ap 0 reg 11 R11  0x00000000
  16:38:55:880 : w ap 0 reg 12 R12  0x00000000
  16:38:55:881 : w ap 0 reg 13 SP   0x00000000
  16:38:55:882 : w ap 0 reg 14 LR   0x20000001
  16:38:55:882 : w ap 0 reg 15 PC   0x20000005
  16:38:55:883 : w ap 0 reg 16 xPSR 0x01000000
  16:38:55:884 : w ap 0 reg 17 MSP  0x2000093E
  16:38:55:887 : w ap 0 reg 18 PSP  0x00000000
  16:38:55:887 : run ap 0 
  16:38:55:887 : halt ap 0 
  16:38:55:887 : r ap 0 reg 0 R0   0x00000001
  16:38:55:888 : w ap 0 reg 0 R0   0x0801B000
  16:38:55:888 : w ap 0 reg 1 R1   0x0000003C
  16:38:55:888 : w ap 0 reg 2 R2   0x20000960
  16:38:55:888 : w ap 0 reg 3 R3   0x00000002
  16:38:55:888 : w ap 0 reg 4 R4   0x00000000
  16:38:55:889 : w ap 0 reg 5 R5   0x00000000
  16:38:55:889 : w ap 0 reg 6 R6   0x00000000
  16:38:55:890 : w ap 0 reg 7 R7   0x00000000
  16:38:55:890 : w ap 0 reg 8 R8   0x00000000
  16:38:55:890 : w ap 0 reg 9 R9   0x00000000
  16:38:55:890 : w ap 0 reg 10 R10  0x00000000
  16:38:55:890 : w ap 0 reg 11 R11  0x00000000
  16:38:55:891 : w ap 0 reg 12 R12  0x00000000
  16:38:55:891 : w ap 0 reg 13 SP   0x00000000
  16:38:55:891 : w ap 0 reg 14 LR   0x20000001
  16:38:55:891 : w ap 0 reg 15 PC   0x2000002F
  16:38:55:891 : w ap 0 reg 16 xPSR 0x01000000
  16:38:55:891 : w ap 0 reg 17 MSP  0x2000093E
  16:38:55:891 : w ap 0 reg 18 PSP  0x00000000
  16:38:55:891 : run ap 0 
  16:38:55:892 : w ap 0 @0x2000099C 0x0000003C bytes Data 0x0801B800
  16:38:55:892 : W B2 in RAM @0x20008360 size 0x0000003C: 0027ms
  16:38:55:892 : r ap 0 reg 0 R0   0x00000001
  16:38:55:892 : Wait W B1 in Flash @0x0801B000 size 0x0000003C: 0001ms
  16:38:55:893 : w ap 0 reg 0 R0   0x0801B03C
  16:38:55:893 : w ap 0 reg 1 R1   0x0000003C
  16:38:55:894 : w ap 0 reg 2 R2   0x2000099C
  16:38:55:894 : w ap 0 reg 3 R3   0x00000002
  16:38:55:894 : w ap 0 reg 4 R4   0x00000000
  16:38:55:894 : w ap 0 reg 5 R5   0x00000000
  16:38:55:895 : w ap 0 reg 6 R6   0x00000000
  16:38:55:895 : w ap 0 reg 7 R7   0x00000000
  16:38:55:896 : w ap 0 reg 8 R8   0x00000000
  16:38:55:897 : w ap 0 reg 9 R9   0x00000000
  16:38:55:898 : w ap 0 reg 10 R10  0x00000000
  16:38:55:899 : w ap 0 reg 11 R11  0x00000000
  16:38:55:899 : w ap 0 reg 12 R12  0x00000000
  16:38:55:901 : w ap 0 reg 13 SP   0x00000000
  16:38:55:901 : w ap 0 reg 14 LR   0x20000001
  16:38:55:903 : w ap 0 reg 15 PC   0x2000002F
  16:38:55:903 : w ap 0 reg 16 xPSR 0x01000000
  16:38:55:903 : w ap 0 reg 17 MSP  0x2000093E
  16:38:55:903 : w ap 0 reg 18 PSP  0x00000000
  16:38:55:903 : run ap 0 
  16:38:55:904 : r ap 0 reg 0 R0   0x00000001
  16:38:55:904 : Write elapsed time: 0042ms
  16:38:55:904 : Segment[0] downloaded successfully
  16:38:55:905 : File download complete
  16:38:55:924 : Time elapsed during download operation: 00:00:00.130
  16:38:55:924 : RUNNING Program ... 
  16:38:55:924 :   Address:      : 0x0801B000
  16:38:55:934 : w ap 0 reg 15 PC   0x0801B858
  16:38:55:936 : w ap 0 reg 17 MSP  0x0801B800
  16:38:55:939 : w ap 0 reg 16 xPSR 0x01000000
  16:38:55:940 : Warning: The core is locked up
  16:38:55:954 : Start operation achieved successfully

Extra ball: if i do full chip erase and then i flash again my small config file at start address 0x0801B000 i also get the Warning: The core is locked up

we dont need to firmware by ourselves, lets talk
1 ACCEPTED SOLUTION

Accepted Solutions

I did overcome this issue purely by ignoring It.

I Believe the core is locked Up message showed Up because cubeprogrammer was tryingto run the binary file right after flashing.

As It was just raw config data not compiled Code , thus it was crashing​

we dont need to firmware by ourselves, lets talk

View solution in original post

2 REPLIES 2
CCend.2
Associate III

I'm having the same issue when flashing my chip using STM32CubeProgrammer. Were you ever able to fix it?

I did overcome this issue purely by ignoring It.

I Believe the core is locked Up message showed Up because cubeprogrammer was tryingto run the binary file right after flashing.

As It was just raw config data not compiled Code , thus it was crashing​

we dont need to firmware by ourselves, lets talk