Skip to content

Commit

Permalink
Erase 2Kbytes pages on STM32F103xC/D/E devices
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnchain committed Jun 11, 2021
1 parent c399209 commit 995a04e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ FWTARGETS += stm32l062x8 stm32l063x8
FWTARGETS += stm32l072v8 stm32l072xb stm32l072xc
FWTARGETS += stm32l073v8 stm32l073xb stm32l073xc
FWTARGETS += stm32l476xc stm32l476xe stm32l476xg
FWTARGETS += stm32f103x4 stm32f103x6 stm32f103x8 stm32f103xb
FWTARGETS += stm32f103x4 stm32f103x6 stm32f103x8 stm32f103xb stm32f103xc
FWTARGETS += stm32f303xb stm32f303xc stm32f303xd stm32f303xe
FWTARGETS += stm32f429xe stm32f429xg stm32f429xi stm32f429xi_hs
FWTARGETS += stm32f105xb stm32f107xb
Expand Down Expand Up @@ -412,6 +412,12 @@ stm32f103xb :
FWDEFS='STM32F1 STM32F103x6 USBD_ASM_DRIVER' \
LDPARAMS='ROMLEN=128K RAMLEN=20K'

stm32f103xc :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m3' \
FWSTARTUP='mcu/stm32f103.S' \
FWDEFS='STM32F1 STM32F103xE USBD_ASM_DRIVER' \
LDPARAMS='ROMLEN=256K RAMLEN=48K'

stm32f303xb :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f303.S' \
Expand Down
5 changes: 5 additions & 0 deletions mcu/stm32f103.S
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,13 @@ program_flash:
.L_flash_loop:
subs r2, 0x02
blt Err_done
#if defined(STM32F103xE)
/* check for the page start (2k page) on STM32F103xC/D/E devices*/
lsls r4, r0, 21
#else
/* check for the page start (1k page)*/
lsls r4, r0, 22
#endif
bne .L_do_write
/* erasing page */
movs r4, 0x02 // PER
Expand Down

0 comments on commit 995a04e

Please sign in to comment.