diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2020-11-21 21:57:14 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2020-11-21 21:57:14 -0700 |
commit | 822c68c74ebc3ac3694f87d516f1e91f2ce1d0fe (patch) | |
tree | 709b480c0d0283501c2376713f6b495c32292520 /02-usart/include | |
parent | b073c19f9ec330423fa07c66d1c0604883044f6b (diff) | |
download | stm32l4-822c68c74ebc3ac3694f87d516f1e91f2ce1d0fe.tar.gz stm32l4-822c68c74ebc3ac3694f87d516f1e91f2ce1d0fe.tar.bz2 stm32l4-822c68c74ebc3ac3694f87d516f1e91f2ce1d0fe.zip |
Fix mem.c to use the address of DATA_SEGMENT_START instead of the value
Diffstat (limited to '02-usart/include')
-rw-r--r-- | 02-usart/include/arch/x86_64/arch.h | 4 | ||||
-rw-r--r-- | 02-usart/include/mem.h | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/02-usart/include/arch/x86_64/arch.h b/02-usart/include/arch/x86_64/arch.h index accc449..e87559b 100644 --- a/02-usart/include/arch/x86_64/arch.h +++ b/02-usart/include/arch/x86_64/arch.h @@ -27,7 +27,7 @@ // Pretend there's a data segement at the start of SRAM1 for more accurate // testing. #define GHOST_DATA_SEGMENT_SIZE 1234 -#define DATA_SEGMENT_START SRAM1_BASE -#define DATA_SEGMENT_STOP (SRAM1_BASE + GHOST_DATA_SEGMENT_SIZE) +#define DATA_SEGMENT_START (*((uint8_t*)SRAM1_BASE)) +#define DATA_SEGMENT_STOP (*(((uint8_t*)SRAM1_BASE) + GHOST_DATA_SEGMENT_SIZE)) #endif /* ARCH_H_ */ diff --git a/02-usart/include/mem.h b/02-usart/include/mem.h index f376e7d..d150744 100644 --- a/02-usart/include/mem.h +++ b/02-usart/include/mem.h @@ -4,8 +4,11 @@ #include "arch.h" #include <stddef.h> +#define DATA_SEGMENT_STOP_ADDR ((uint8_t*) &DATA_SEGMENT_STOP) +#define DATA_SEGMENT_START_ADDR ((uint8_t*) &DATA_SEGMENT_START) + #define MAX_HEAP_SIZE \ - ((16384 - (DATA_SEGMENT_STOP - DATA_SEGMENT_START)) / 4 * 4) + ((16384 - (DATA_SEGMENT_STOP_ADDR - DATA_SEGMENT_START_ADDR)) / 4 * 4) /* allocates memory on the head, which is stored in sram2 */ void* halloc(size_t n); |