-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
72 lines (51 loc) · 2.02 KB
/
Makefile
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright 2020 Bga <bga.email@gmail.com>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
export PATH := $(PATH):$(HOME)/local/sdcc/bin
MCU = stm8s003f3
ARCH = stm8
F_CPU ?= 16000000
PROFILE ?= Release
TARGET ?= iar-stm8-project/$(PROFILE)/Exe/app.out
# BUILD_DIR = ./sdcc-build
LIBDIR = /E/p/!electronics/!stm8/stm8-bare-min/stm8s/lib
SRCS := $(wildcard *.c $(LIBDIR)/*.c)
ASRCS := $(wildcard src/*.s $(LIBDIR)/*.s)
all: $(TARGET) size
# $(BUILD_DIR):
# @mkdir -p $@
$(TARGET): $(SRCS)
IarBuild.bat iar-stm8-project/stm8-volt-amper-meter-iar.ewp $(PROFILE)
$(TARGET)-flash.bin: $(TARGET)
tools/iar-stm8_dump-flash.sh $(TARGET)
$(TARGET)-eeprom.bin: $(TARGET)
tools/iar-stm8_dump-eeprom.sh $(TARGET)
size: $(TARGET)-flash.bin
@echo "----------"
@echo "Image size:"
@stat -L -c %s $(TARGET)-flash.bin
flash-write: $(TARGET)-flash.bin
stm8flash -c stlinkv2 -s flash -p $(MCU) -w $<
flash-verify: $(TARGET)-flash.bin
stm8flash -c stlinkv2 -s flash -p $(MCU) -v $<
flash-read: $(TARGET)-flash.bin
stm8flash -c stlinkv2 -s flash -p $(MCU) -r $<
eeprom-write: $(TARGET)-eeprom.bin
stm8flash -c stlinkv2 -s eeprom -p $(MCU) -w $<
eeprom-verify: $(TARGET)-eeprom.bin
stm8flash -c stlinkv2 -s eeprom -p $(MCU) -v $<
eeprom-read: $(TARGET)-eeprom.bin
stm8flash -c stlinkv2 -s eeprom -p $(MCU) -r $<
# serial: $(TARGET).bin
# stm8gal -p /dev/ttyUSB0 -w $(TARGET).bin
clean:
rm -rf iar-stm8-project/{Release,Debug,*.dep}
# IarBuild.bat iar-project/blink.ewp -clean Release
.PHONY: clean all size flash-write flash-read eeprom-write eeprom-read