Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit 23e6583

Browse files
ernststormodvolden
authored andcommitted
Use Thumb mode jump address for GO command
As discussed in the ST forums [1], the bootloader requires an odd (Thumb mode) address for the GO command. If an even address is used, the Cortex M does something like a software reset, but this is not generated by the write to AICR in stm_reset_code, but by an exception due to the even address which is not compatible with Thumb mode. ARM specifies 'Hard Fault' for this case: http://infocenter.arm.com/help/ index.jsp?topic=/com.arm.doc.dui0497a/BABDCDHA.html [1] https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/System%20boot%20mode%20and%20Go%20command%20STM32f103rbt6 Signed-off-by: Ernst Schwab <eschwab@online.de>
1 parent e26cc79 commit 23e6583

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static stm32_err_t stm32_run_raw_code(const stm32_t *stm,
880880
const uint8_t *code, uint32_t code_size)
881881
{
882882
uint32_t stack_le = le_u32(0x20002000);
883-
uint32_t code_address_le = le_u32(target_address + 8);
883+
uint32_t code_address_le = le_u32(target_address + 8 + 1); // thumb mode address (!)
884884
uint32_t length = code_size + 8;
885885
uint8_t *mem, *pos;
886886
uint32_t address, w;

0 commit comments

Comments
 (0)