Skip to content

Commit 6ccf221

Browse files
dgarskedanielinux
authored andcommitted
Fixes for building TI Hercules.
1 parent 16296e4 commit 6ccf221

5 files changed

Lines changed: 41 additions & 7 deletions

File tree

IDE/CCS/TMS570LC43xx/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
11
# TMS750LC43xx
22

3+
# Prerequisites
4+
5+
Download and install:
6+
1) "Code Composer Studio" - https://www.ti.com/tool/CCSTUDIO
7+
2) "F021 Flash API - Software" - https://www.ti.com/tool/F021FLASHAPI
8+
9+
Note: Avoid using spaces in the paths. Consider renaming "F021 Flash API" to "F021_Flash_API".
10+
311
# Build
412

513
## Build from command line (msys, cygwin, etc)
614

15+
1) Setup default configuration:
16+
17+
```
18+
cp config/examples/ti-tms570lc435.config .config
19+
```
20+
21+
2) Build passing in CCS_ROOT and F021_DIR make variables:
22+
23+
Windows:
24+
```
25+
make CCS_ROOT=/c/ti/ccs1250/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS F021_DIR=/c/ti/Hercules/F021\ Flash\ API/02.01.01
26+
```
27+
28+
Mac OS:
729
```
8-
make CCS_ROOT=/c/ti/ccs1031/ccs/tools/compiler/ti-cgt-arm_20.2.4.LTS F021_DIR=/c/ti/Hercules/F021\ Flash\ API/02.01.01
30+
make CCS_ROOT=/Applications/ti/ccs1250/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS F021_DIR=/Applications/ti/Hercules/F021_Flash_API/02.01.01
931
```
1032

1133
## Build using Code Composer Studio (CCS)

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DEBUG?=0
2323
DEBUG_UART?=0
2424
LIBS=
2525
SIGN_ALG=
26+
OBJCOPY_FLAGS=
2627

2728
OBJS:= \
2829
./hal/$(TARGET).o \
@@ -67,7 +68,12 @@ ifeq ($(USE_GCC_HEADLESS),1)
6768
LDFLAGS+=-Wl,-gc-sections -Wl,-Map=wolfboot.map -ffreestanding -nostartfiles
6869
# Not setting LDFLAGS directly since it is passed to the test-app
6970
LSCRIPT_FLAGS+=-T $(LSCRIPT)
71+
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
7072
endif
73+
ifeq ($(TARGET),ti_hercules)
74+
LSCRIPT_FLAGS+=--run_linker $(LSCRIPT)
75+
endif
76+
7177

7278
MAIN_TARGET=factory.bin
7379
TARGET_H_TEMPLATE:=include/target.h.in
@@ -136,7 +142,7 @@ wolfboot.efi: wolfboot.elf
136142

137143
wolfboot.bin: wolfboot.elf
138144
@echo "\t[BIN] $@"
139-
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary $^ $@
145+
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary $^ $@
140146
@echo
141147
@echo "\t[SIZE]"
142148
$(Q)$(SIZE) wolfboot.elf
@@ -153,7 +159,7 @@ standalone:
153159
MCUXPRESSO=$(MCUXPRESSO) MCUXPRESSO_CPU=$(MCUXPRESSO_CPU) MCUXPRESSO_DRIVERS=$(MCUXPRESSO_DRIVERS) \
154160
MCUXPRESSO_CMSIS=$(MCUXPRESSO_CMSIS) NVM_FLASH_WRITEONCE=$(NVM_FLASH_WRITEONCE) \
155161
FREEDOM_E_SDK=$(FREEDOM_E_SDK) standalone
156-
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary test-app/image.elf standalone.bin
162+
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary test-app/image.elf standalone.bin
157163
$(Q)$(SIZE) test-app/image.elf
158164

159165
include tools/test.mk

arch.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ ifeq ($(TARGET),ti_hercules)
491491
CFLAGS+=-D"CORTEX_R5" -D"BIG_ENDIAN_ORDER" -D"NVM_FLASH_WRITEONCE" -D"FLASHBUFFER_SIZE=32"
492492
STACK_USAGE=0
493493
USE_GCC=0
494+
USE_GCC_HEADLESS=0
494495

495496
ifeq ($(CCS_ROOT),)
496497
$(error "CCS_ROOT must be defined to root of tools")
@@ -510,7 +511,7 @@ ifeq ($(TARGET),ti_hercules)
510511
CFLAGS+=$(ARCH_FLAGS)
511512
LDFLAGS+=$(ARCH_FLAGS) -i"$(CCS_ROOT)/lib" -i"$(F021_DIR)" -z --be32 --map_file=wolfboot.map --reread_libs --diag_wrap=off --display_error_number --warn_sections --heap_size=0 --stack_size=0x800 --ram_model
512513
LD_START_GROUP= #--start-group
513-
LD_END_GROUP= -llibc.a -l"$(F021_DIR)\\F021_API_CortexR4_BE_L2FMC_V3D16.lib" $(LSCRIPT)
514+
LD_END_GROUP= -llibc.a -l"$(F021_DIR)/F021_API_CortexR4_BE_L2FMC_V3D16.lib"
514515

515516
OPTIMIZATION_LEVEL=2
516517
endif

stage1/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ ifeq ($(USE_GCC_HEADLESS),1)
7777
CFLAGS+=-ffunction-sections -fdata-sections
7878
LDFLAGS+=-Wl,-gc-sections -Wl,-Map=loader_stage1.map
7979
LSCRIPT_FLAGS+=-T $(LSCRIPT)
80+
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
8081
endif
8182

8283
MAIN_TARGET=loader_stage1.bin
@@ -124,7 +125,7 @@ all: $(MAIN_TARGET)
124125

125126
loader_stage1.bin: loader_stage1.elf
126127
@echo "\t[BIN] $@"
127-
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary $^ $@
128+
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary $^ $@
128129
@echo
129130
@echo "\t[SIZE]"
130131
$(Q)$(SIZE) loader_stage1.elf

test-app/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ include ../arch.mk
4848
# Setup default linker flags
4949
LDFLAGS+=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map
5050

51+
# Setup default objcopy flags
52+
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
53+
5154
ifeq ($(DEBUG_UART),1)
5255
APP_OBJS+=../src/string.o
5356
endif
@@ -161,7 +164,8 @@ endif
161164
ifeq ($(TARGET),ti_hercules)
162165
LSCRIPT_TEMPLATE=ARM-r5be.ld
163166
# Override linker flags
164-
LDFLAGS=$(LSCRIPT) --map_file=image.map
167+
LDFLAGS=--run_linker $(LSCRIPT) --map_file=image.map
168+
OBJCOPY_FLAGS=
165169
endif
166170

167171
ifeq ($(TARGET),sim)
@@ -338,7 +342,7 @@ delta-extra-data:LDFLAGS=-Wl,-Map=image.map
338342

339343
image.bin: image.elf
340344
@echo "\t[BIN] $@"
341-
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary $^ $@
345+
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary $^ $@
342346

343347
image.elf: $(APP_OBJS) $(LSCRIPT)
344348
@echo "\t[LD] $@"

0 commit comments

Comments
 (0)