-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_make.txt
42 lines (31 loc) · 1.25 KB
/
new_make.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
SHELL=cmd
CC=arm-none-eabi-gcc
AS=arm-none-eabi-as
LD=arm-none-eabi-ld
CCFLAGS=-mcpu=cortex-m0 -mthumb -g
# Search for the path of the right libraries. Works only on Windows.
GCCPATH=$(subst \bin\arm-none-eabi-gcc.exe,\,$(shell where $(CC)))
LIBPATH1=$(subst \libgcc.a,,$(shell dir /s /b "$(GCCPATH)*libgcc.a" | find "v6-m"))
LIBPATH2=$(subst \libc_nano.a,,$(shell dir /s /b "$(GCCPATH)*libc_nano.a" | find "v6-m"))
LIBSPEC=-L"$(LIBPATH1)" -L"$(LIBPATH2)"
OBJS=main.o init.o serial.o adc.o newlib_stubs.o
PORTN=$(shell type COMPORT.inc)
main.hex: $(OBJS) stm32f05xxx.ld
$(LD) $(OBJS) $(LIBSPEC) -Os -u _printf_float -nostdlib -lnosys -lgcc -T stm32f05xxx.ld --cref -Map main.map -nostartfiles -o main.elf
arm-none-eabi-objcopy -O ihex main.elf main.hex
@echo Success!
main.o: main.c stm32f05xxx.h
$(CC) -c $(CCFLAGS) main.c -o main.o
clean:
@del $(OBJS) 2>NUL
@del main.elf main.hex main.map 2>NUL
Load_Flash: main.hex
@Taskkill /IM putty.exe /F 2>NUL | wait 500
STMFlashLoader -ft230 -c -i STM32F0_5x_3x_64K -e --all -d --fn main.hex --v
putty:
@Taskkill /IM putty.exe /F 2>NUL | wait 500
c:\putty\putty.exe -serial $(PORTN) -sercfg 115200,8,n,1,N -v
explorer:
@explorer .
dummy: main.map main.hex stm32f05xxx.ld
@echo Hello from 'dummy' target...