aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2018-01-15 14:46:12 -0700
committerJosh Rahm <joshuarahm@gmail.com>2018-01-15 14:46:12 -0700
commit8e20f53dd3b33058508ff51bd19e49df19b06fb7 (patch)
tree9c8fa042aa57ebc94ad7e31519b243c3f00ff001
parent178921510fb527ef294b29b690ec2ac1ac696d8e (diff)
downloadstm32l4-8e20f53dd3b33058508ff51bd19e49df19b06fb7.tar.gz
stm32l4-8e20f53dd3b33058508ff51bd19e49df19b06fb7.tar.bz2
stm32l4-8e20f53dd3b33058508ff51bd19e49df19b06fb7.zip
reorganize sources into src and include directories.
-rw-r--r--system-clock/Makefile.preamble4
-rwxr-xr-xsystem-clock/genmake.pl18
-rw-r--r--system-clock/include/clock.h (renamed from system-clock/clock.h)0
-rw-r--r--system-clock/include/common.h (renamed from system-clock/common.h)0
-rw-r--r--system-clock/include/gpio.h (renamed from system-clock/gpio.h)0
-rw-r--r--system-clock/linker/linker_script.ld (renamed from system-clock/linker_script.ld)0
-rw-r--r--system-clock/linker/main.map (renamed from system-clock/main.map)24
-rw-r--r--system-clock/src/clock.c (renamed from system-clock/clock.c)0
-rw-r--r--system-clock/src/gpio.c (renamed from system-clock/gpio.c)0
-rw-r--r--system-clock/src/main.c (renamed from system-clock/main.c)0
10 files changed, 25 insertions, 21 deletions
diff --git a/system-clock/Makefile.preamble b/system-clock/Makefile.preamble
index b53a130..4be2dac 100644
--- a/system-clock/Makefile.preamble
+++ b/system-clock/Makefile.preamble
@@ -2,8 +2,8 @@ OPT?=-O
PREFIX?=arm-unknown-eabi-
CC=$(PREFIX)gcc
LD=$(PREFIX)ld
-CFLAGS?=$(OPT) -mcpu=cortex-m4 -mthumb -g -lgcc -static -nostartfiles
-LD_FLAGS?=-T linker_script.ld -nostdlib --cref -Map main.map -static
+CFLAGS?=$(OPT) -mcpu=cortex-m4 -mthumb -g -lgcc -static -nostartfiles -Iinclude
+LD_FLAGS?=-T linker/linker_script.ld -nostdlib --cref -Map linker/main.map -static
all: _$(PREFIX)_obs/main.elf
diff --git a/system-clock/genmake.pl b/system-clock/genmake.pl
index 80026b1..84387ee 100755
--- a/system-clock/genmake.pl
+++ b/system-clock/genmake.pl
@@ -11,14 +11,14 @@ sub header_deps {
push(@headers, $file);
while (<$fh>) {
- /#include\s+"(.*)"\s*$/ && push(@headers, header_deps($1));
+ /#include\s+"(.*)"\s*$/ && push(@headers, header_deps("include/$1"));
}
}
return @headers;
}
-my @files = glob('*.c');
+my @files = glob('src/*.c');
my @obj_files;
open(my $fh, '<:encoding(UTF-8)', "Makefile.preamble")
@@ -29,8 +29,12 @@ while (<$fh>) {
}
# Emit a rule that will rerun genmake if the c files do not match.
-my $idempotency_cmd="ls *.c *.h| sha1sum | awk '{print \$ 1}'";
-my $idempotency_cmd_make="ls *.c *.h | sha1sum | awk '{print \$\$1}'";
+my $idempotency_cmd =
+ "ls src/*.c include/*.h| sha1sum | awk '{print \$1}'";
+
+my $idempotency_cmd_make =
+ "ls src/*.c include/*.h | sha1sum | awk '{print \$\$1}'";
+
print "IDEMPOTENCY_HASH=" . `$idempotency_cmd` . "\n";
my $arch_obs_dir = "_\$(PREFIX)_obs";
@@ -38,10 +42,10 @@ print "$arch_obs_dir:\n\t";
print "mkdir $arch_obs_dir\n";
foreach $file (@files) {
- (my $file_no_ext = $file) =~ s/\.c$//g;
+ my $c_file = $file;
+ (my $file_no_ext = $file) =~ s/src\/(.*)\.c$/\1/g;
my $obj_file = "$arch_obs_dir/${file_no_ext}.o";
- my $c_file = "${file_no_ext}.c";
my $s_file = "${file_no_ext}.s";
push(@obj_files, $obj_file);
@@ -60,7 +64,7 @@ foreach $file (@files) {
my $obj_files_deps = join(' ', @obj_files);
print "FORCE:\n\t\n\n";
-print "$arch_obs_dir/main.elf: FORCE $obj_files_deps linker_script.ld\n\t";
+print "$arch_obs_dir/main.elf: FORCE $obj_files_deps linker/linker_script.ld\n\t";
print "([ \"\$\$($idempotency_cmd_make)\" != \"\$(IDEMPOTENCY_HASH)\" ] "
. "&& ./genmake.pl > Makefile && make main.elf ) "
. "|| "
diff --git a/system-clock/clock.h b/system-clock/include/clock.h
index 2ba6880..2ba6880 100644
--- a/system-clock/clock.h
+++ b/system-clock/include/clock.h
diff --git a/system-clock/common.h b/system-clock/include/common.h
index f58f179..f58f179 100644
--- a/system-clock/common.h
+++ b/system-clock/include/common.h
diff --git a/system-clock/gpio.h b/system-clock/include/gpio.h
index 53ece32..53ece32 100644
--- a/system-clock/gpio.h
+++ b/system-clock/include/gpio.h
diff --git a/system-clock/linker_script.ld b/system-clock/linker/linker_script.ld
index fe0c14b..fe0c14b 100644
--- a/system-clock/linker_script.ld
+++ b/system-clock/linker/linker_script.ld
diff --git a/system-clock/main.map b/system-clock/linker/main.map
index 8c920bf..a201354 100644
--- a/system-clock/main.map
+++ b/system-clock/linker/main.map
@@ -87,18 +87,18 @@ OUTPUT(_arm-unknown-eabi-_obs/main.elf elf32-littlearm)
.debug_ranges 0x0000000000000000 0x20
.debug_ranges 0x0000000000000000 0x20 _arm-unknown-eabi-_obs/clock.o
-.debug_line 0x0000000000000000 0x403
- .debug_line 0x0000000000000000 0x15d _arm-unknown-eabi-_obs/clock.o
- .debug_line 0x000000000000015d 0x103 _arm-unknown-eabi-_obs/gpio.o
- .debug_line 0x0000000000000260 0x1a3 _arm-unknown-eabi-_obs/main.o
-
-.debug_str 0x0000000000000000 0x38c
- .debug_str 0x0000000000000000 0x176 _arm-unknown-eabi-_obs/clock.o
- 0x1bc (size before relaxing)
- .debug_str 0x0000000000000176 0x1e1 _arm-unknown-eabi-_obs/gpio.o
- 0x2cf (size before relaxing)
- .debug_str 0x0000000000000357 0x35 _arm-unknown-eabi-_obs/main.o
- 0x27a (size before relaxing)
+.debug_line 0x0000000000000000 0x427
+ .debug_line 0x0000000000000000 0x169 _arm-unknown-eabi-_obs/clock.o
+ .debug_line 0x0000000000000169 0x10f _arm-unknown-eabi-_obs/gpio.o
+ .debug_line 0x0000000000000278 0x1af _arm-unknown-eabi-_obs/main.o
+
+.debug_str 0x0000000000000000 0x398
+ .debug_str 0x0000000000000000 0x17a _arm-unknown-eabi-_obs/clock.o
+ 0x1c0 (size before relaxing)
+ .debug_str 0x000000000000017a 0x1e5 _arm-unknown-eabi-_obs/gpio.o
+ 0x2d3 (size before relaxing)
+ .debug_str 0x000000000000035f 0x39 _arm-unknown-eabi-_obs/main.o
+ 0x27e (size before relaxing)
.comment 0x0000000000000000 0x3c
.comment 0x0000000000000000 0x3c _arm-unknown-eabi-_obs/clock.o
diff --git a/system-clock/clock.c b/system-clock/src/clock.c
index b846ceb..b846ceb 100644
--- a/system-clock/clock.c
+++ b/system-clock/src/clock.c
diff --git a/system-clock/gpio.c b/system-clock/src/gpio.c
index ab3606d..ab3606d 100644
--- a/system-clock/gpio.c
+++ b/system-clock/src/gpio.c
diff --git a/system-clock/main.c b/system-clock/src/main.c
index f7a30e8..f7a30e8 100644
--- a/system-clock/main.c
+++ b/system-clock/src/main.c