Files

50 lines
762 B
Markdown
Raw Permalink Normal View History

# 执行AI 测试固件模板
## C语言测试固件示例
```c
#include <stdint.h>
#include <stdio.h>
#define LED_PIN 13
void delay(volatile uint32_t count) {
while (count--);
}
int main(void) {
// 初始化 GPIO
GPIO_Init();
printf("MCU芯片测试开始\n");
while (1) {
// LED 闪烁
GPIO_Toggle(LED_PIN);
printf("LED Toggle\n");
delay(1000000);
}
}
```
## 编译配置 (Makefile)
```makefile
CC = arm-none-eabi-gcc
CFLAGS = -mcpu=cortex-m7 -mthumb -O2
LDFLAGS = -T linker.ld
TARGET = firmware
SRC = main.c
all: $(TARGET).hex
$(TARGET).elf: $(SRC)
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
$(TARGET).hex: $(TARGET).elf
arm-none-eabi-objcopy -O ihex $< $@
clean:
rm -f *.elf *.hex
```