DFU Support

This commit is contained in:
NIIBE Yutaka
2012-05-28 12:53:58 +09:00
parent 3588fbd97a
commit ba8609be41
3 changed files with 13 additions and 12 deletions

View File

@@ -1,12 +1,13 @@
2012-05-28 Niibe Yutaka <gniibe@fsij.org> 2012-05-28 Niibe Yutaka <gniibe@fsij.org>
* src/gnuk.ld.in (.sys): Add alignment settings. * boards/*/board.c (hwinit0): Removed...
* boards/common/hwinit.c (hwinit0): ... and define here.
* boards/common/hwinit.c (hwinit0): Define here. (hwinit0) [DFU_SUPPORT]: Don't set SCB->VTOR here.
* boards/*/board.c (hwinit0): Removed. * src/sys.c (reset) [DFU_SUPPORT]: Set SCB->VTOR here.
* polarssl-0.14.0/library/aes.c (FT0, FT1, FT2): Specify the * polarssl-0.14.0/library/aes.c (FT0, FT1, FT2): Specify the
section ".sys", so that we will have more room for flash ROM. section ".sys", so that we will have more room for flash ROM.
* src/gnuk.ld.in (.sys): Add alignment settings.
* tool/gnuk_upgrade.py (main): First 4096-byte of Gnuk is system * tool/gnuk_upgrade.py (main): First 4096-byte of Gnuk is system
block. Don't send it to reGNUal. block. Don't send it to reGNUal.

View File

@@ -32,10 +32,6 @@
void void
hwinit0 (void) hwinit0 (void)
{ {
#ifdef DFU_SUPPORT
SCB->VTOR = 0x08003000;
#endif
stm32_clock_init(); stm32_clock_init();
} }

View File

@@ -1,3 +1,4 @@
#include "config.h"
#include "ch.h" #include "ch.h"
#include "hal.h" #include "hal.h"
#include "board.h" #include "board.h"
@@ -173,8 +174,6 @@ flash_protect (void)
return (option_bytes_value & 0xff) == 0xff ? 1 : 0; return (option_bytes_value & 0xff) == 0xff ? 1 : 0;
} }
#define FLASH_MASS_ERASE_TIMEOUT 0xF0000000
extern uint8_t __flash_start__, __flash_end__; extern uint8_t __flash_start__, __flash_end__;
extern uint8_t _regnual_start; extern uint8_t _regnual_start;
@@ -249,9 +248,14 @@ reset (void)
asm volatile ("cpsid i\n\t" /* Mask all interrupts */ asm volatile ("cpsid i\n\t" /* Mask all interrupts */
"mov.w r0, #0xed00\n\t" /* SCR */ "mov.w r0, #0xed00\n\t" /* SCR */
"movt r0, #0xe000\n\t" "movt r0, #0xe000\n\t"
"mov.w r1, #0x1000\n\t" /* 08001000 */ #ifdef DFU_SUPPORT
"mov.w r1, #0x4000\n\t" /* 0x08004000 */
"movt r1, #0x0800\n\t" "movt r1, #0x0800\n\t"
"str r1, [r0, #8]\n\t" /* SCR->VCR = 0x08001000 */ #else
"mov.w r1, #0x1000\n\t" /* 0x08001000 */
"movt r1, #0x0800\n\t"
#endif
"str r1, [r0, #8]\n\t" /* Set SCR->VCR */
"ldr r0, [r1], #4\n\t" "ldr r0, [r1], #4\n\t"
"msr MSP, r0\n\t" /* Main (exception handler) stack */ "msr MSP, r0\n\t" /* Main (exception handler) stack */
"ldr r0, [r1]\n\t" /* Reset handler */ "ldr r0, [r1]\n\t" /* Reset handler */