Skip to content

Commit

Permalink
Fixes for building TI Hercules.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske authored and danielinux committed Feb 6, 2024
1 parent 16296e4 commit 6ccf221
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
24 changes: 23 additions & 1 deletion IDE/CCS/TMS570LC43xx/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
# TMS750LC43xx

# Prerequisites

Download and install:
1) "Code Composer Studio" - https://www.ti.com/tool/CCSTUDIO
2) "F021 Flash API - Software" - https://www.ti.com/tool/F021FLASHAPI

Note: Avoid using spaces in the paths. Consider renaming "F021 Flash API" to "F021_Flash_API".

# Build

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

1) Setup default configuration:

```
cp config/examples/ti-tms570lc435.config .config
```

2) Build passing in CCS_ROOT and F021_DIR make variables:

Windows:
```
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
```

Mac OS:
```
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
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
```

## Build using Code Composer Studio (CCS)
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DEBUG?=0
DEBUG_UART?=0
LIBS=
SIGN_ALG=
OBJCOPY_FLAGS=

OBJS:= \
./hal/$(TARGET).o \
Expand Down Expand Up @@ -67,7 +68,12 @@ ifeq ($(USE_GCC_HEADLESS),1)
LDFLAGS+=-Wl,-gc-sections -Wl,-Map=wolfboot.map -ffreestanding -nostartfiles
# Not setting LDFLAGS directly since it is passed to the test-app
LSCRIPT_FLAGS+=-T $(LSCRIPT)
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
endif
ifeq ($(TARGET),ti_hercules)
LSCRIPT_FLAGS+=--run_linker $(LSCRIPT)
endif


MAIN_TARGET=factory.bin
TARGET_H_TEMPLATE:=include/target.h.in
Expand Down Expand Up @@ -136,7 +142,7 @@ wolfboot.efi: wolfboot.elf

wolfboot.bin: wolfboot.elf
@echo "\t[BIN] $@"
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary $^ $@
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary $^ $@
@echo
@echo "\t[SIZE]"
$(Q)$(SIZE) wolfboot.elf
Expand All @@ -153,7 +159,7 @@ standalone:
MCUXPRESSO=$(MCUXPRESSO) MCUXPRESSO_CPU=$(MCUXPRESSO_CPU) MCUXPRESSO_DRIVERS=$(MCUXPRESSO_DRIVERS) \
MCUXPRESSO_CMSIS=$(MCUXPRESSO_CMSIS) NVM_FLASH_WRITEONCE=$(NVM_FLASH_WRITEONCE) \
FREEDOM_E_SDK=$(FREEDOM_E_SDK) standalone
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary test-app/image.elf standalone.bin
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary test-app/image.elf standalone.bin
$(Q)$(SIZE) test-app/image.elf

include tools/test.mk
Expand Down
3 changes: 2 additions & 1 deletion arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ ifeq ($(TARGET),ti_hercules)
CFLAGS+=-D"CORTEX_R5" -D"BIG_ENDIAN_ORDER" -D"NVM_FLASH_WRITEONCE" -D"FLASHBUFFER_SIZE=32"
STACK_USAGE=0
USE_GCC=0
USE_GCC_HEADLESS=0

ifeq ($(CCS_ROOT),)
$(error "CCS_ROOT must be defined to root of tools")
Expand All @@ -510,7 +511,7 @@ ifeq ($(TARGET),ti_hercules)
CFLAGS+=$(ARCH_FLAGS)
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
LD_START_GROUP= #--start-group
LD_END_GROUP= -llibc.a -l"$(F021_DIR)\\F021_API_CortexR4_BE_L2FMC_V3D16.lib" $(LSCRIPT)
LD_END_GROUP= -llibc.a -l"$(F021_DIR)/F021_API_CortexR4_BE_L2FMC_V3D16.lib"

OPTIMIZATION_LEVEL=2
endif
Expand Down
3 changes: 2 additions & 1 deletion stage1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ifeq ($(USE_GCC_HEADLESS),1)
CFLAGS+=-ffunction-sections -fdata-sections
LDFLAGS+=-Wl,-gc-sections -Wl,-Map=loader_stage1.map
LSCRIPT_FLAGS+=-T $(LSCRIPT)
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
endif

MAIN_TARGET=loader_stage1.bin
Expand Down Expand Up @@ -124,7 +125,7 @@ all: $(MAIN_TARGET)

loader_stage1.bin: loader_stage1.elf
@echo "\t[BIN] $@"
$(Q)$(OBJCOPY) --gap-fill $(FILL_BYTE) -O binary $^ $@
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary $^ $@
@echo
@echo "\t[SIZE]"
$(Q)$(SIZE) loader_stage1.elf
Expand Down
8 changes: 6 additions & 2 deletions test-app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ include ../arch.mk
# Setup default linker flags
LDFLAGS+=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map

# Setup default objcopy flags
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)

ifeq ($(DEBUG_UART),1)
APP_OBJS+=../src/string.o
endif
Expand Down Expand Up @@ -161,7 +164,8 @@ endif
ifeq ($(TARGET),ti_hercules)
LSCRIPT_TEMPLATE=ARM-r5be.ld
# Override linker flags
LDFLAGS=$(LSCRIPT) --map_file=image.map
LDFLAGS=--run_linker $(LSCRIPT) --map_file=image.map
OBJCOPY_FLAGS=
endif

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

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

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

0 comments on commit 6ccf221

Please sign in to comment.