diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-03-22 17:30:42 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-03-22 17:30:42 +0100 |
commit | 1cd0285b22755a21cbc367213a143ec33d298c95 (patch) | |
tree | 8b7848f74d3512d74507abee781005c64b82a0f3 | |
parent | 8495bc3169939d034622dcbf6fb84016a7430ef2 (diff) |
add static makefile targets to main gamefile, and add target to flash static rom to stm32
-rw-r--r-- | src/makefile | 14 | ||||
-rw-r--r-- | src/ppusim/sim.c | 3 | ||||
-rw-r--r-- | src/stm32/setup.c | 4 | ||||
-rw-r--r-- | src/tilemap.h | 7 |
4 files changed, 27 insertions, 1 deletions
diff --git a/src/makefile b/src/makefile index cd248e2..51ce7e9 100644 --- a/src/makefile +++ b/src/makefile @@ -78,7 +78,15 @@ $(TARGET).bin: $(TARGET).elf PHONY += flash flash: $(TARGET).bin - st-flash --reset write $(TARGET).bin 0x08000000 + st-flash --reset write $< 0x08000000 + +# see definition of g_hh_tilemap_rom in stm32/setup.c +PHONY += rom +rom: static/tilemap.bin + st-flash --reset write $< 0x08033000 + +static/tilemap.bin static/tilemap.h &: + $(MAKE) -C static all %-ds.o: %.c $(CC) -c $(CFLAGS) $< -o $@ @@ -99,4 +107,8 @@ PHONY += clean clean: $(RM) $(TARGET).bin $(TARGET).elf $(OBJS) +PHONY += distclean +distclean: clean + $(MAKE) -C static clean + .PHONY: $(PHONY) diff --git a/src/ppusim/sim.c b/src/ppusim/sim.c index 8b67acc..4d171a0 100644 --- a/src/ppusim/sim.c +++ b/src/ppusim/sim.c @@ -10,9 +10,11 @@ #include "ppusim/mem.h" #include "ppusim/sim.h" #include "ppusim/work.h" +#include "tilemap.h" SDL_Window *g_hh_window = NULL; SDL_Renderer *g_hh_renderer = NULL; +uint32_t* g_hh_tilemap_rom = NULL; void hh_ppu_init() { SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS); @@ -29,6 +31,7 @@ void hh_ppu_init() { } void hh_ppu_load_tilemap() { + g_hh_tilemap_rom = NULL; // TODO: read/copy file (static/tilemap.bin) //TODO: remove magic file name here char* filename = "static/tiles.bin"; FILE* fp = fopen(filename,"rb"); diff --git a/src/stm32/setup.c b/src/stm32/setup.c index 2c3552b..2102347 100644 --- a/src/stm32/setup.c +++ b/src/stm32/setup.c @@ -8,6 +8,10 @@ #include "main.h" #include "setup.h" #include "ppu/ppu.h" +#include "tilemap.h" + +// hex(0x0803_ffff - 0xd000 + 1) (stm32f091rc rm0091 table 5, flash memory organization) +uint32_t* g_hh_tilemap_rom = 0x08033000; UART_HandleTypeDef huart2 = { .Instance = USART2, diff --git a/src/tilemap.h b/src/tilemap.h new file mode 100644 index 0000000..2f8b709 --- /dev/null +++ b/src/tilemap.h @@ -0,0 +1,7 @@ +#pragma once +#include <stdint.h> + +#include "static/tilemap.h" + +extern uint32_t* g_hh_tilemap_rom; + |