]> git.sur5r.net Git - openocd/commit
stm32f2x: Fix byte order bug.
authorJens Bauer <jens@gpio.dk>
Fri, 16 Jan 2015 22:57:09 +0000 (23:57 +0100)
committerPaul Fertser <fercerpav@gmail.com>
Fri, 30 Jan 2015 08:55:23 +0000 (08:55 +0000)
commit9d745a0690f6f5c24d914ebfa3c1d6b824a19a5e
treee8c0575b2ba787e3e111a63e2a20fc4dc4270438
parent08da1b4258a971a068401849c65b9d40f08ee44c
stm32f2x: Fix byte order bug.

Do not use buf_set_u32 on integers; they're not buffers.
If using buf_set_u32 on integers, bytes will be exchanged on Big Endian targets.
In this particular case, FLASH_OPTCR was incorrectly written, causing it to often
contain one of these values: 0x00aaaae1, 0x00aaffef, 0x00ffabe1 or 0x00abffe1.
This write-protected the device before flash-programming, causing this command...
flash write_image erase unlock myfile.elf
... to fail, complaining about write-protection.
Repeating the above command would change the OPTCR register each time.
After applying this patch, the OPTCR remains "unchanged".

Change-Id: I73d510fcc2e81a01973ad5c6e1aa22715ebd2743
Signed-off-by: Jens Bauer <jens@gpio.dk>
Reviewed-on: http://openocd.zylin.com/2466
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/flash/nor/stm32f2x.c