Skip to content

Commit

Permalink
Extend initial vector table to avoid checksum addr
Browse files Browse the repository at this point in the history
The LPC43xx/43Sxx family of MCUs will only boot from internal flash
if the boot image contains a valid signature. Valid signatures are
generated by placing the 2's complement of the sum of vector table
entries 0 through 6 at the Cortex-M4's reserved exception vector
location 7. A short initial vector table allows for the incorrect
placement of executable code around the checksum address offset
(0x001C). During flashing of board, OpenOCD's lpc2000 flash driver
will calculate checksum and write it to the forementioned address,
thus corrupting code. In order to avoid code corruption initial
vector table was extended up to Cortex-M4's Systick exception.
  • Loading branch information
martinmarcos committed Jun 9, 2017
1 parent da994b4 commit 8439700
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bsps/lpc4337_educiaa/bsp/start-ram.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ __vectors0:
.word hang /* 2 NMI */
.word hang /* 3 HardFault */
.word hang /* 4 MemManage */
.word hang /* 5 Bus fault. */
.word hang /* 6 Usage fault. */
.word hang /* 7 reserved. */
.word hang /* 8 reserved. */
.word hang /* 9 reserved. */
.word hang /* 10 reserved. */
.word hang /* 11 SVCall. */
.word hang /* 12 Breakpoint. */
.word hang /* 13 reserved. */
.word hang /* 14 PendSV. */
.word hang /* 15 Systick. */

.text

Expand Down
11 changes: 11 additions & 0 deletions bsps/lpc4337_educiaa/bsp/start-rom.S
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ __vectors0:
.word hang /* 2 NMI */
.word hang /* 3 HardFault */
.word hang /* 4 MemManage */
.word hang /* 5 Bus fault. */
.word hang /* 6 Usage fault. */
.word hang /* 7 reserved. */
.word hang /* 8 reserved. */
.word hang /* 9 reserved. */
.word hang /* 10 reserved. */
.word hang /* 11 SVCall. */
.word hang /* 12 Breakpoint. */
.word hang /* 13 reserved. */
.word hang /* 14 PendSV. */
.word hang /* 15 Systick. */

.text

Expand Down

0 comments on commit 8439700

Please sign in to comment.