mirror of
https://salsa.debian.org/gnuk-team/gnuk/gnuk.git
synced 2024-09-20 10:50:09 +00:00
improve DFU_SUPPORT
This commit is contained in:
parent
8d8e67f1ad
commit
e2ab8c9183
@ -1,5 +1,11 @@
|
|||||||
2012-05-29 Niibe Yutaka <gniibe@fsij.org>
|
2012-05-29 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* src/sys.c (reset): Don't depend if DFU_SUPPORT or not.
|
||||||
|
|
||||||
|
* polarssl-0.14.0/library/aes.c (FT0, FT1, FT2): Specify sections
|
||||||
|
in detail, so that addresses won't be affected by compiler.
|
||||||
|
* src/gnuk.ld.in (.sys): Define sections in detail.
|
||||||
|
|
||||||
* boards/STBEE_MINI/board.h (SET_USB_CONDITION, GPIO_USB)
|
* boards/STBEE_MINI/board.h (SET_USB_CONDITION, GPIO_USB)
|
||||||
(IOPORT_USB, SET_LED_CONDITION, GPIO_LED, IOPORT_LED)
|
(IOPORT_USB, SET_LED_CONDITION, GPIO_LED, IOPORT_LED)
|
||||||
(FLASH_PAGE_SIZE): New.
|
(FLASH_PAGE_SIZE): New.
|
||||||
|
@ -172,15 +172,15 @@ static const unsigned char FSb[256] =
|
|||||||
V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C)
|
V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C)
|
||||||
|
|
||||||
#define V(a,b,c,d) 0x##a##b##c##d
|
#define V(a,b,c,d) 0x##a##b##c##d
|
||||||
static const unsigned long FT0[256] __attribute__((section(".sys"))) = { FT };
|
static const unsigned long FT0[256] __attribute__((section(".sys.0"))) = { FT };
|
||||||
#undef V
|
#undef V
|
||||||
|
|
||||||
#define V(a,b,c,d) 0x##b##c##d##a
|
#define V(a,b,c,d) 0x##b##c##d##a
|
||||||
static const unsigned long FT1[256] __attribute__((section(".sys"))) = { FT };
|
static const unsigned long FT1[256] __attribute__((section(".sys.1"))) = { FT };
|
||||||
#undef V
|
#undef V
|
||||||
|
|
||||||
#define V(a,b,c,d) 0x##c##d##a##b
|
#define V(a,b,c,d) 0x##c##d##a##b
|
||||||
static const unsigned long FT2[256] __attribute__((section(".sys"))) = { FT };
|
static const unsigned long FT2[256] __attribute__((section(".sys.2"))) = { FT };
|
||||||
#undef V
|
#undef V
|
||||||
|
|
||||||
#define V(a,b,c,d) 0x##d##a##b##c
|
#define V(a,b,c,d) 0x##d##a##b##c
|
||||||
|
@ -57,7 +57,9 @@ SECTIONS
|
|||||||
sys.o(.rodata)
|
sys.o(.rodata)
|
||||||
sys.o(.rodata.*)
|
sys.o(.rodata.*)
|
||||||
. = ALIGN(1024);
|
. = ALIGN(1024);
|
||||||
*(.sys)
|
*(.sys.0)
|
||||||
|
*(.sys.1)
|
||||||
|
*(.sys.2)
|
||||||
} > flash0
|
} > flash0
|
||||||
|
|
||||||
.text : ALIGN(16) SUBALIGN(16)
|
.text : ALIGN(16) SUBALIGN(16)
|
||||||
|
23
src/sys.c
23
src/sys.c
@ -1,4 +1,3 @@
|
|||||||
#include "config.h"
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
@ -252,20 +251,18 @@ nvic_system_reset (void)
|
|||||||
static void __attribute__ ((naked))
|
static void __attribute__ ((naked))
|
||||||
reset (void)
|
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" /* r0 = SCR */
|
||||||
"movt r0, #0xe000\n\t"
|
"movt r0, #0xe000\n\t"
|
||||||
#ifdef DFU_SUPPORT
|
"mov r1, pc\n\t" /* r1 = (PC + 0x1000) & ~0x0fff */
|
||||||
"mov.w r1, #0x4000\n\t" /* 0x08004000 */
|
"mov r2, #0x1000\n\t"
|
||||||
"movt r1, #0x0800\n\t"
|
"add r1, r1, r2\n\t"
|
||||||
#else
|
"sub r2, r2, #1\n\t"
|
||||||
"mov.w r1, #0x1000\n\t" /* 0x08001000 */
|
"bic r1, r1, r2\n\t"
|
||||||
"movt r1, #0x0800\n\t"
|
"str r1, [r0, #8]\n\t" /* Set SCR->VCR */
|
||||||
#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. */
|
||||||
"bx r0\n"
|
"bx r0\n"
|
||||||
: /* no output */ : /* no input */ : "memory");
|
: /* no output */ : /* no input */ : "memory");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user