File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ AS:=$(CROSS_COMPILE)gcc
77OBJCOPY: =$(CROSS_COMPILE ) objcopy
88SIZE: =$(CROSS_COMPILE ) size
99BOOT_IMG? =test-app/image.bin
10- BOOT0_OFFSET? =0x10000
10+ BOOT0_OFFSET? =0x20000
1111SIGN? =ED25519
1212TARGET? =stm32f4
1313DEBUG? =0
Original file line number Diff line number Diff line change 66 * Ensure that your firmware entry point is
77 * at FLASH_AREA_IMAGE_0_OFFSET + 0x100
88 */
9- #define WOLFBOOT_SECTOR_SIZE 0x1000
10- #define WOLFBOOT_PARTITION_SIZE 0x10000
9+ #define WOLFBOOT_SECTOR_SIZE 0x20000
10+ #define WOLFBOOT_PARTITION_SIZE 0x20000
1111
12- #define WOLFBOOT_PARTITION_BOOT_ADDRESS 0x10000
13- #define WOLFBOOT_PARTITION_UPDATE_ADDRESS 0x20000
14- #define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x30000
12+ #define WOLFBOOT_PARTITION_BOOT_ADDRESS 0x20000
13+ #define WOLFBOOT_PARTITION_UPDATE_ADDRESS 0x40000
14+ #define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x60000
1515
1616#endif
Original file line number Diff line number Diff line change @@ -3,12 +3,8 @@ CC:=$(CROSS_COMPILE)gcc
33LD: =$(CROSS_COMPILE ) gcc
44OBJS: =startup.o main.o timer.o led.o system.o
55TARGET? =none
6-
76LSCRIPT: =app.ld
8-
97OBJCOPY: =$(CROSS_COMPILE ) objcopy
10-
11-
128CFLAGS:=-mcpu =cortex-m3 -mthumb -g -ggdb -Wall -Wno-main -Wstack-usage=200 -ffreestanding -Wno-unused -nostdlib -DPLATFORM_$(TARGET )
139LDFLAGS: =-T $(LSCRIPT ) -Wl,-gc-sections -Wl,-Map=image.map -nostdlib
1410
@@ -18,6 +14,12 @@ image.bin: image.elf
1814
1915image.elf : $(OBJS ) $(LSCRIPT )
2016 $(LD ) $(LDFLAGS ) $(OBJS ) -o $@
17+
18+ standalone:CFLAGS+ =-DPLATFORM_stm32f4
19+ standalone:LDFLAGS: =-T standalone.ld -Wl,-gc-sections -Wl,-Map=image.map -nostdlib
20+
21+
22+ standalone : image.bin
2123
2224startup.o : startup.c
2325
Original file line number Diff line number Diff line change 3232#define GPIOD_OSPD (*(volatile uint32_t *)(GPIOD_BASE + 0x08))
3333#define GPIOD_PUPD (*(volatile uint32_t *)(GPIOD_BASE + 0x0c))
3434#define GPIOD_ODR (*(volatile uint32_t *)(GPIOD_BASE + 0x14))
35+ #define GPIOD_BSRR (*(volatile uint32_t *)(GPIOD_BASE + 0x18))
3536#define GPIOD_AFL (*(volatile uint32_t *)(GPIOD_BASE + 0x20))
3637#define GPIOD_AFH (*(volatile uint32_t *)(GPIOD_BASE + 0x24))
3738#define LED_PIN (15)
38-
39+ #define LED_BOOT_PIN (14)
3940#define GPIO_OSPEED_100MHZ (0x03)
40-
41-
42- void led_setup (void )
43- {
44- uint32_t reg ;
45- AHB1_CLOCK_ER |= GPIOD_AHB1_CLOCK_ER ;
46- reg = GPIOD_MODE & ~ (0x03 << (LED_PIN * 2 ));
47- GPIOD_MODE = reg | (1 << (LED_PIN * 2 ));
48-
49- reg = GPIOD_PUPD & (0x03 << (LED_PIN * 2 ));
50- GPIOD_PUPD = reg | (0x02 << (LED_PIN * 2 ));
51- }
52-
5341void led_pwm_setup (void )
5442{
5543 uint32_t reg ;
@@ -66,6 +54,16 @@ void led_pwm_setup(void)
6654 /* Alternate function: use high pin */
6755 reg = GPIOD_AFH & ~(0xf << ((LED_PIN - 8 ) * 4 ));
6856 GPIOD_AFH = reg | (0x2 << ((LED_PIN - 8 ) * 4 ));
57+ }
6958
59+ void boot_led_on (void )
60+ {
61+ uint32_t reg ;
62+ AHB1_CLOCK_ER |= GPIOD_AHB1_CLOCK_ER ;
63+ reg = GPIOD_MODE & ~(0x03 << (LED_BOOT_PIN * 2 ));
64+ GPIOD_MODE = reg | (1 << (LED_BOOT_PIN * 2 ));
65+ reg = GPIOD_PUPD & ~(0x03 << (LED_BOOT_PIN * 2 ));
66+ GPIOD_PUPD = reg | (1 << (LED_BOOT_PIN * 2 ));
67+ GPIOD_BSRR |= (1 << LED_BOOT_PIN );
7068}
7169
Original file line number Diff line number Diff line change @@ -5,4 +5,5 @@ void led_on(void);
55void led_off (void );
66void led_toggle (void );
77void led_pwm_setup (void );
8+ void boot_led_on (void );
89#endif
Original file line number Diff line number Diff line change 3030#ifdef PLATFORM_stm32f4
3131
3232void main (void ) {
33+ boot_led_on ();
3334 flash_set_waitstates ();
3435 clock_config ();
3536 led_pwm_setup ();
@@ -76,8 +77,6 @@ void main(void)
7677
7778#endif
7879
79-
80-
8180#ifdef PLATFORM_samr21
8281void main (void ) {
8382 asm volatile ("cpsie i" );
@@ -86,11 +85,3 @@ void main(void) {
8685}
8786#endif
8887
89- #ifdef PLATFORM_lm3s
90- void main (void ) {
91- asm volatile ("cpsie i" );
92- while (1 )
93- WFI ();
94- }
95- #endif
96-
Original file line number Diff line number Diff line change 1+ MEMORY
2+ {
3+ FLASH (rx) : ORIGIN = 0x00000000 , LENGTH = 0x001FF00
4+ RAM (rwx) : ORIGIN = 0x20000000 , LENGTH = 0x00010000
5+ }
6+
7+ SECTIONS
8+ {
9+ .text :
10+ {
11+ _start_text = .;
12+ KEEP (*(.isr_vector ))
13+ *(.text *)
14+ *(.rodata *)
15+ . = ALIGN (4 );
16+ _end_text = .;
17+ } > FLASH
18+
19+ _stored_data = .;
20+
21+ .data : AT (_stored_data)
22+ {
23+ _start_data = .;
24+ KEEP (*(.data *))
25+ . = ALIGN (4 );
26+ _end_data = .;
27+ } > RAM
28+
29+ .bss :
30+ {
31+ _start_bss = .;
32+ *(.bss *)
33+ *(COMMON)
34+ . = ALIGN (4 );
35+ _end_bss = .;
36+ _end = .;
37+ } > RAM
38+ }
39+
40+ PROVIDE (_start_heap = _end);
41+ PROVIDE (_end_stack = ORIGIN (RAM) + LENGTH(RAM));
You can’t perform that action at this time.
0 commit comments