Skip to content

Commit c840851

Browse files
authored
Merge pull request #48 from danielinux/psoc6-app-fix
Fixes/improvements: psoc6 test application
2 parents a48bc60 + ed94f79 commit c840851

5 files changed

Lines changed: 74 additions & 11 deletions

File tree

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
include tools/config.mk
99

1010
## Initializers
11+
WOLFBOOT_ROOT=$(PWD)
1112
CFLAGS:=-D__WOLFBOOT -DWOLFBOOT_VERSION=$(WOLFBOOT_VERSION)UL -ffunction-sections -fdata-sections
1213
LSCRIPT:=config/target.ld
1314
LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=wolfboot.map -ffreestanding -nostartfiles
@@ -21,6 +22,7 @@ WOLFCRYPT_OBJS:=
2122
PUBLIC_KEY_OBJS:=
2223
UPDATE_OBJS:=
2324

25+
2426
ifeq ($(SIGN),RSA4096)
2527
SPMATH=0
2628
endif
@@ -207,7 +209,7 @@ wolfboot-align.bin: .bootloader-partition-size wolfboot.bin
207209
@echo
208210

209211
test-app/image.bin: wolfboot-align.bin
210-
@make -C test-app
212+
@make -C test-app WOLFBOOT_ROOT=$(WOLFBOOT_ROOT)
211213
@rm -f src/*.o hal/*.o
212214
@$(SIZE) test-app/image.elf
213215

config/examples/cypsoc6.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ ARCH?=ARM
22
TARGET?=psoc6
33
SIGN?=ED25519
44
HASH?=SHA256
5-
CYPRESS_PDL?=./lib/psoc6pdl
6-
CYPRESS_TARGET_LIB?=./lib/TARGET_CY8CKIT-062S2-43012
7-
CYPRESS_CORE_LIB?=./lib/core-lib
5+
CYPRESS_PDL?=$(WOLFBOOT_ROOT)/lib/psoc6pdl
6+
CYPRESS_TARGET_LIB?=$(WOLFBOOT_ROOT)/lib/TARGET_CY8CKIT-062S2-43012
7+
CYPRESS_CORE_LIB?=$(WOLFBOOT_ROOT)/lib/core-lib
88
DEBUG?=1
99
VTOR?=1
1010
CORTEX_M0?=1

test-app/ARM-psoc6.ld

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ SECTIONS
1010
.text :
1111
{
1212
_start_text = .;
13+
__Vectors = .;
1314
KEEP(*(.isr_vector))
15+
KEEP(*(.vectors))
1416
. = ALIGN(0x400);
1517
*(.text*)
1618
*(.rodata*)
1719
*(.init*)
1820
*(.fini*)
1921
. = ALIGN(4);
2022
_end_text = .;
23+
__etext = .;
2124
} > FLASH
2225

2326
.edidx :
@@ -31,25 +34,64 @@ SECTIONS
3134
.data : AT (_stored_data)
3235
{
3336
_start_data = .;
37+
__data_start__ = .;
38+
3439
KEEP(*(.data*))
3540
. = ALIGN(4);
41+
KEEP(*(.ramcode))
42+
. = ALIGN(4);
43+
/* preinit data */
44+
PROVIDE_HIDDEN (__preinit_array_start = .);
45+
KEEP(*(.preinit_array))
46+
PROVIDE_HIDDEN (__preinit_array_end = .);
47+
48+
. = ALIGN(4);
49+
/* init data */
50+
PROVIDE_HIDDEN (__init_array_start = .);
51+
KEEP(*(SORT(.init_array.*)))
52+
KEEP(*(.init_array))
53+
PROVIDE_HIDDEN (__init_array_end = .);
54+
55+
. = ALIGN(4);
56+
/* finit data */
57+
PROVIDE_HIDDEN (__fini_array_start = .);
58+
KEEP(*(SORT(.fini_array.*)))
59+
KEEP(*(.fini_array))
60+
PROVIDE_HIDDEN (__fini_array_end = .);
61+
62+
KEEP(*(.jcr*))
63+
. = ALIGN(4);
64+
65+
KEEP(*(.cy_ramfunc*))
66+
. = ALIGN(4);
67+
3668
_end_data = .;
69+
__data_end__ = .;
70+
3771
} > RAM
3872

3973
.bss (NOLOAD) :
4074
{
4175
_start_bss = .;
4276
__bss_start__ = .;
77+
__zero_table_start__ = .;
4378
*(.bss*)
4479
*(COMMON)
4580
. = ALIGN(4);
4681
_end_bss = .;
4782
__bss_end__ = .;
83+
__zero_table_end__ = .;
4884
_end = .;
85+
. = ALIGN(0x100);
86+
__ramVectors = .;
4987
} > RAM
5088
. = ALIGN(4);
5189
}
5290

5391
END_STACK = ORIGIN(RAM) + LENGTH(RAM);
54-
PROVIDE(_start_heap = _end);
55-
PROVIDE(_end_stack = ORIGIN(RAM) + LENGTH(RAM));
92+
PROVIDE(_end_stack = END_STACK);
93+
PROVIDE(_start_heap = END_STACK);
94+
95+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
96+
__StackLimit = __StackTop - 0x4000;
97+
PROVIDE(__stack = __StackTop);

test-app/Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ ifeq ($(TARGET),stm32f7)
4646
LSCRIPT_TEMPLATE=ARM-stm32f7.ld
4747
CFLAGS+=-DDUALBANK_SWAP
4848
endif
49-
ifeq ($(TARGET),psoc6)
50-
LSCRIPT_TEMPLATE=ARM-psoc6.ld
51-
endif
52-
5349
LDFLAGS:=$(CFLAGS) -T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map
5450

5551
ifeq ($(EXT_FLASH),1)
@@ -110,6 +106,22 @@ ifeq ($(TARGET),hifive1)
110106
APP_OBJS+=hifive1_write_page.o
111107
endif
112108

109+
# $(CYPRESS_PDL)/devices/templates/COMPONENT_MTB/COMPONENT_CM0P/system_psoc6_cm0plus.o
110+
111+
ifeq ($(TARGET),psoc6)
112+
LSCRIPT_TEMPLATE:=ARM-psoc6.ld
113+
APP_OBJS+= $(CYPRESS_PDL)/drivers/source/cy_gpio.o
114+
APP_OBJS+= $(CYPRESS_PDL)/drivers/source/cy_device.o
115+
CFLAGS+=-I$(CYPRESS_PDL)/drivers/include/
116+
CFLAGS+=-I$(CYPRESS_PDL)/devices/include
117+
CFLAGS+=-I$(CYPRESS_PDL)/cmsis/include
118+
CFLAGS+=-I$(CYPRESS_TARGET_LIB)
119+
CFLAGS+=-I$(CYPRESS_CORE_LIB)/include
120+
CFLAGS+=-I$(CYPRESS_PDL)/devices/include/ip
121+
CFLAGS+=-I$(CYPRESS_PDL)/devices/templates/COMPONENT_MTB
122+
CFLAGS+=-DCY8C624ABZI_D44
123+
endif
124+
113125
standalone:CFLAGS+=-DTEST_APP_STANDALONE
114126
standalone:LDFLAGS:=$(CFLAGS) -T standalone.ld -Wl,-gc-sections -Wl,-Map=image.map
115127

test-app/app_psoc6.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@
2626
#include <string.h>
2727
#include "wolfboot/wolfboot.h"
2828

29+
#include "cy_gpio.h"
30+
31+
#define BOOT_LED P1_5
32+
#define BOOT_D7 P5_7
33+
2934

3035
void main(void) {
31-
/* Wait for reboot */
36+
Cy_PDL_Init(CY_DEVICE_CFG);
37+
Cy_GPIO_Pin_FastInit(P5_7_PORT, P5_7_NUM, CY_GPIO_DM_PULLUP, 0UL, P5_7_GPIO);
38+
Cy_GPIO_Pin_FastInit(P1_5_PORT, P1_5_NUM, CY_GPIO_DM_PULLUP, 0UL, P1_5_GPIO);
3239
while(1)
3340
;
3441
}

0 commit comments

Comments
 (0)