diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2020-11-16 18:20:32 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2020-11-16 18:20:32 -0700 |
commit | 9f17335c19a6ae91a450e267b5313148644a7a14 (patch) | |
tree | f1ae946ada62148913a8cc10bc985f8de926a4a0 /02-usart/genmake.pl | |
parent | 4767c73fb2e1f96469fe24a83b443c1774b01d86 (diff) | |
download | stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.tar.gz stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.tar.bz2 stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.zip |
Add DMA header file which defines the DMA registers and add
testing_harness with fake environment to allow testing on x86
development machines.
Diffstat (limited to '02-usart/genmake.pl')
-rwxr-xr-x | 02-usart/genmake.pl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/02-usart/genmake.pl b/02-usart/genmake.pl index 341db3d..a0e99de 100755 --- a/02-usart/genmake.pl +++ b/02-usart/genmake.pl @@ -19,6 +19,7 @@ sub header_deps { } my @files = glob('src/*.c'); +my @test_files = glob('tests/*.c'); my @obj_files; open(my $fh, '<:encoding(UTF-8)', "Makefile.preamble") @@ -30,10 +31,10 @@ while (<$fh>) { # Emit a rule that will rerun genmake if the c files do not match. my $idempotency_cmd = - "ls src/*.c include/*.h| sha1sum | awk '{print \$1}'"; + "ls src/*.c include/*.h tests/*.c | sha1sum | awk '{print \$1}'"; my $idempotency_cmd_make = - "ls src/*.c include/*.h | sha1sum | awk '{print \$\$1}'"; + "ls src/*.c include/*.h tests/*.c | sha1sum | awk '{print \$\$1}'"; print "IDEMPOTENCY_HASH=" . `$idempotency_cmd` . "\n"; @@ -62,6 +63,23 @@ foreach $file (@files) { } my $obj_files_deps = join(' ', @obj_files); + +foreach $file (@test_files) { + my $c_file = $file; + (my $file_no_ext = $file) =~ s/(.*)\.c/\1/g; + my @deps = header_deps($c_file); + my $deps_as_join = join(" ", @deps); + + print "_${file_no_ext}: $deps_as_join $obj_files_deps test_harness/test_harness.a\n\t"; + print '$(CC) $(CFLAGS) -o' . $file_no_ext . ' ' . $c_file . ' ' . $obj_file_deps . " test_harness/test_harness.a\n\n"; + + print "${file_no_ext}: $deps_as_join $obj_files_deps test_harness/test_harness.a\n\t"; + print 'PREFIX=$(TEST_PREFIX) CFLAGS="$(TEST_CFLAGS)" $(MAKE) _' . $file_no_ext . "\n\n"; +} + +print "test_harness/test_harness.a: test_harness/test_harness.h test_harness/test_harness.c\n\t"; +print 'cd test_harness; $(MAKE) test_harness.a; cd ..' . "\n\n"; + print "FORCE:\n\t\n\n"; print "$arch_obs_dir/main.elf: FORCE $obj_files_deps linker/linker_script.ld\n\t"; print "([ \"\$\$($idempotency_cmd_make)\" != \"\$(IDEMPOTENCY_HASH)\" ] " |