feat : Add GitHub Actions workflow for SDCC build and test on CC2530

- This commit adds a new GitHub Actions workflow for building and testing SDCC (Software Development Compiler) on CC2530.
- The changes are to update the build process for Zigbee sensor firmware, switching from MSP430 compiler to sdcc and updating object file generation rules.
- This commit updates the build system for the project, adding and configuring new paths, compiler settings, and dependencies for the Z-Stack SDK.
This commit is contained in:
2025-02-23 10:12:09 +01:00
parent 69de01e9b3
commit 51601be546
3 changed files with 107 additions and 15 deletions

View File

@@ -7,27 +7,29 @@ ZSTACK_DIR = ./include
INCLUDE_DIRS = -I$(ZSTACK_DIR)
# Compiler settings
CC = msp430-elf-gcc # MSP430 compiler
# CFLAGS (C Compiler flags)
CFLAGS = $(INCLUDE_DIRS) -Wall -O2 # Enable all warnings, Optimize for size
LDFLAGS =
LIBS = -lZStack -lhal # ZStack for Zigbee communication, lhal for Hardware Abstraction Layer library
CC = sdcc # sdcc compiler
CFLAGS = -mmc51 $(INCLUDE_DIRS) # add include paths to compiler flags
SRCS = main.c zigbee_comm.c sensors/bme280.c sensors/wind_vane.c sensors/rain_gauge.c sensors/anemometer.c include/hal_timer.c
SRC=$(wildcard *.c)
HEADERS = main.h zigbee_comm.h sensors/bme280.h sensors/wind_vane.h sensors/rain_gauge.h sensors/anemometer.h config.h include/hal_types.h include/hal_defs.h include/hal_timer.h include/ZComDef.h include/OSAL.h include/i2c.h
OBJS = $(SRCS:.c=.o) # create a list of object files from the source files
all: main.elf
# Object files (replace .c with .o)
OBJS = $(SRCS:.c=.o)
main.elf: $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
# Output file
OUTPUT=output.ihx
# Default target: compile and generate the hex file
all: $(OUTPUT)
# Rule to build the output file
$(OUTPUT): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(OUTPUT)
# Rule to build object files from source files
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
# Clean generated files
clean:
rm -f main.elf $(OBJS)
# Optionally add a rule to flash your device (if applicable)
# flash: main.elf
# ./flash_tool main.elf # This is just a placeholder if needed
rm -f $(OUTPUT) $(OBJS) *.asm *.lst *.sym