前天发现以前量产的STM芯片,15块的,现在售价300一片,然后找了半天mcu,选择来测试华大的,打开官方例程,对于一个从来没有用过iar,和mdk的人来说,好家伙,居然没有linux下的gcc 例子,但是仔细一看,iar里面有linker文件,有汇编文件. 前天,耐不住性子,既然有linker ,我能不能自己写makefile来编译呢,就尝试用vscode使用arm-none-eabi,来玩玩,居然成功了,但是手里没有PCB,什么也没有,这星期就打算画个板子,来验证一下自己的编译的程序。附上部分makefile代码
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
OUT_DIR = out_target
######################################
# source
######################################
# C sources
C_SOURCES = \
mcu/common/src/system_hc32f460.c \
driver/src/hc32f460_adc.c \
driver/src/hc32f460_aes.c \
driver/src/hc32f460_can.c \
driver/src/hc32f460_clk.c \
driver/src/hc32f460_cmp.c \
driver/src/hc32f460_crc.c \
driver/src/hc32f460_dcu.c \
driver/src/hc32f460_dmac.c \
driver/src/hc32f460_efm.c \
driver/src/hc32f460_emb.c \
driver/src/hc32f460_event_port.c \
driver/src/hc32f460_exint_nmi_swi.c \
driver/src/hc32f460_gpio.c \
driver/src/hc32f460_hash.c \
driver/src/hc32f460_i2c.c \
driver/src/hc32f460_i2s.c \
driver/src/hc32f460_icg.c \
driver/src/hc32f460_interrupts.c \
driver/src/hc32f460_keyscan.c \
driver/src/hc32f460_mpu.c \
driver/src/hc32f460_ots.c \
driver/src/hc32f460_pwc.c \
driver/src/hc32f460_qspi.c \
driver/src/hc32f460_rmu.c \
driver/src/hc32f460_rtc.c \
driver/src/hc32f460_sdioc.c \
driver/src/hc32f460_spi.c \
driver/src/hc32f460_sram.c \
driver/src/hc32f460_swdt.c \
driver/src/hc32f460_timer0.c \
driver/src/hc32f460_timer4_cnt.c \
driver/src/hc32f460_timer4_emb.c \
driver/src/hc32f460_timer4_oco.c \
driver/src/hc32f460_timer4_pwm.c \
driver/src/hc32f460_timer4_sevt.c \
driver/src/hc32f460_timer6.c \
driver/src/hc32f460_timera.c \
driver/src/hc32f460_trng.c \
driver/src/hc32f460_usart.c \
driver/src/hc32f460_utility.c \
driver/src/hc32f460_wdt.c \
mysys/src/mysys.c \
src/main.c
# ASM sources
ASM_SOURCES = \
startup_hc32f460.s
#######################################
# binaries
#######################################
PREFIX = D:/Software/gcc-arm-none-eabi/bin/arm-none-eabi-
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
|