diff --git a/.gitignore b/.gitignore index 09146ef0..95e4f9e6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ /[Mm]odules/[Ss][Gg][Ll]/[Ss][Rr][Cc]/*.o /[Mm]odules/[Tt][Ll][Ss][Ff]/*.o +/[Ss]amples/**/imgui.ini /[Ss]amples/**/*.o /[Ss]amples/**/[Bb]uild[Dd]rop/** /[Cc]ompiler/msys2/tmp/* @@ -50,6 +51,7 @@ /[Tt]ests/**/[Bb]uild[Dd]rop/** /[Tt]ests/**/*.o +/[Tt]ests/**/imgui.ini /[Tt]ests/**/*.log /Projects/** diff --git a/modules/sgl/INC/sgl.h b/modules/sgl/INC/sgl.h index df3c5df3..910379d1 100644 --- a/modules/sgl/INC/sgl.h +++ b/modules/sgl/INC/sgl.h @@ -24,7 +24,7 @@ typedef uint16_t TEXDAT; /********************************/ /* Old Texture Table */ /********************************/ -#define cgaddress 0x10000 +#define cgaddress ((SGL_MAX_POLYGONS + 6) * sizeof(SPRITE) * 2) #define pal COL_32K #define TEXDEF(h,v,presize) {h,v,(cgaddress+(((presize)*4)>>(pal)))/8,(((h)&0x1f8)<<5 | (v))} #define PICDEF(texno,cmode,pcsrc) {(uint16_t)(texno),(uint16_t)(cmode),(void *)(pcsrc)} @@ -32,7 +32,7 @@ typedef uint16_t TEXDAT; /********************************/ /* New Texture Table */ /********************************/ -#define CGADDRESS 0x10000 +#define CGADDRESS ((SGL_MAX_POLYGONS + 6) * sizeof(SPRITE) * 2) #define AdjCG(cga,hs,vs,col) ((cga) + (((((hs)*(vs)*4)>>(col))+0x1f) &0x7ffe0)) #define TEXTBL(hs,vs,cga) {hs , vs , (cga)>>3 , ((hs)&0x1f8)<<5|(vs)} #define PICTBL(texno,cmode,pcsrc) {(uint16_t)(texno),(uint16_t)(cmode),(void *)(pcsrc)} diff --git a/modules/sgl/LIB/LIBADP.A b/modules/sgl/LIB/LIBADP.A index f2bd6621..0d0b1f6e 100644 Binary files a/modules/sgl/LIB/LIBADP.A and b/modules/sgl/LIB/LIBADP.A differ diff --git a/modules/sgl/LIB/LIBCD.A b/modules/sgl/LIB/LIBCD.A index 79250869..ad2b3862 100644 Binary files a/modules/sgl/LIB/LIBCD.A and b/modules/sgl/LIB/LIBCD.A differ diff --git a/modules/sgl/LIB/LIBCD_D.A b/modules/sgl/LIB/LIBCD_D.A index 17f0d527..d64ec6fa 100644 Binary files a/modules/sgl/LIB/LIBCD_D.A and b/modules/sgl/LIB/LIBCD_D.A differ diff --git a/modules/sgl/LIB/LIBMEM.A b/modules/sgl/LIB/LIBMEM.A index fc66c628..b5c7c20c 100644 Binary files a/modules/sgl/LIB/LIBMEM.A and b/modules/sgl/LIB/LIBMEM.A differ diff --git a/modules/sgl/LIB/LIBPCM.A b/modules/sgl/LIB/LIBPCM.A index 5bf153a7..a1b3db0e 100644 Binary files a/modules/sgl/LIB/LIBPCM.A and b/modules/sgl/LIB/LIBPCM.A differ diff --git a/modules/sgl/LIB/LIBSGL.A b/modules/sgl/LIB/LIBSGL.A index b0be8d14..762b656f 100644 Binary files a/modules/sgl/LIB/LIBSGL.A and b/modules/sgl/LIB/LIBSGL.A differ diff --git a/modules/sgl/LIB/LIBSND.A b/modules/sgl/LIB/LIBSND.A index 7c26aee7..bf2a28c4 100644 Binary files a/modules/sgl/LIB/LIBSND.A and b/modules/sgl/LIB/LIBSND.A differ diff --git a/modules/sgl/LIB/SEGA_SYS.A b/modules/sgl/LIB/SEGA_SYS.A index 2ae7e4af..c9d04132 100644 Binary files a/modules/sgl/LIB/SEGA_SYS.A and b/modules/sgl/LIB/SEGA_SYS.A differ diff --git a/modules/sgl/LIB/SGLAREA.O b/modules/sgl/LIB/SGLAREA.O index 8cb7e597..d09ee922 100644 Binary files a/modules/sgl/LIB/SGLAREA.O and b/modules/sgl/LIB/SGLAREA.O differ diff --git a/modules/sgl/LIB/SYS_AREE.O b/modules/sgl/LIB/SYS_AREE.O index 18e2cf5e..3be4a1ab 100644 Binary files a/modules/sgl/LIB/SYS_AREE.O and b/modules/sgl/LIB/SYS_AREE.O differ diff --git a/modules/sgl/LIB/SYS_AREJ.O b/modules/sgl/LIB/SYS_AREJ.O index e8c0ba2d..ef551206 100644 Binary files a/modules/sgl/LIB/SYS_AREJ.O and b/modules/sgl/LIB/SYS_AREJ.O differ diff --git a/modules/sgl/LIB/SYS_ARET.O b/modules/sgl/LIB/SYS_ARET.O index a58dbe15..1d0ea6f4 100644 Binary files a/modules/sgl/LIB/SYS_ARET.O and b/modules/sgl/LIB/SYS_ARET.O differ diff --git a/modules/sgl/LIB/SYS_AREU.O b/modules/sgl/LIB/SYS_AREU.O index c5527dd9..b5b064e9 100644 Binary files a/modules/sgl/LIB/SYS_AREU.O and b/modules/sgl/LIB/SYS_AREU.O differ diff --git a/modules/sgl/LIB/SYS_INIT.O b/modules/sgl/LIB/SYS_INIT.O index 8215ed2e..a680e8bb 100644 Binary files a/modules/sgl/LIB/SYS_INIT.O and b/modules/sgl/LIB/SYS_INIT.O differ diff --git a/modules/sgl/LIB/SYS_SEC.O b/modules/sgl/LIB/SYS_SEC.O index c8a1685d..75a57ef6 100644 Binary files a/modules/sgl/LIB/SYS_SEC.O and b/modules/sgl/LIB/SYS_SEC.O differ diff --git a/modules/sgl/SRC/preloader.cxx b/modules/sgl/SRC/preloader.cxx index 5a0e742f..22bd540b 100644 --- a/modules/sgl/SRC/preloader.cxx +++ b/modules/sgl/SRC/preloader.cxx @@ -12,6 +12,14 @@ extern "C" { */ extern uint32_t _bend; + /** @brief Start of a workarea area section + */ + extern uint32_t _work_area_start; + + /** @brief End of a command buffer section + */ + extern uint32_t _command_buffer_end; + /** @brief Start address of constructor array */ extern void(*__ctors)(); @@ -39,6 +47,12 @@ extern "C" { *bssBlock = 0; } + // Zero stuff inside workarea and command buffer section + for (uint32_t* workareaBlock = &_work_area_start; workareaBlock < &_command_buffer_end; workareaBlock++) + { + *workareaBlock = 0; + } + // Initialize memory management (malloc stuff) SRL::Memory::Initialize(); diff --git a/modules/sgl/SRC/workarea.c b/modules/sgl/SRC/workarea.c index 066c8bca..c8a5b43c 100644 --- a/modules/sgl/SRC/workarea.c +++ b/modules/sgl/SRC/workarea.c @@ -5,22 +5,28 @@ #define _LongWord_ sizeof(uint32_t) #define _Sprite_ (sizeof(uint16_t) * 18) -// #define SGL_MAX_VERTICES 2500 /* number of vertices that can be used */ -// #define SGL_MAX_POLYGONS 1700 /* number of polygons that can be used */ - struct WorkArea_ { - char SortList[(_LongWord_ * 3) * (SGL_MAX_POLYGONS + 6)]; - char Zbuffer[_LongWord_ * SGL_MAX_POLYGONS]; - char SpriteBuf[_Sprite_ * ((SGL_MAX_POLYGONS + 6) * 2)]; - char Pbuffer[(_LongWord_ * 4) * SGL_MAX_VERTICES]; - char CLOfstBuf[(_Byte_ * 32 * 3) * 32]; - char CommandBuf[(_LongWord_ * 8) * SGL_MAX_POLYGONS]; + char __attribute__((aligned(0x10))) SortList[(_LongWord_ * 3) * (SGL_MAX_POLYGONS + 6)]; + char __attribute__((aligned(0x10))) Zbuffer[_LongWord_ * 512]; + char __attribute__((aligned(0x10))) SpriteBuf[_Sprite_ * ((SGL_MAX_POLYGONS + 6) * 2)]; + char __attribute__((aligned(0x10))) Pbuffer[(_LongWord_ * 4) * SGL_MAX_VERTICES]; + char __attribute__((aligned(0x10))) CLOfstBuf[(_Byte_ * 32 * 3) * 32]; }; +struct CommandBufArea_ +{ + char CommandBuf[SGL_SLAVE_BUF_SIZE]; +}; + +// Start must be aligned to 0x1000 struct WorkArea_ __attribute__((section("WORK_AREA_DUMMY"))) WORK_AREA_DUMMY; struct WorkArea_ __attribute__((aligned(0x1000), used, section("WORK_AREA"))) WorkArea; +// Contains commands for slave CPU +struct CommandBufArea_ __attribute__((section("COMMAND_BUF_DUMMY"))) COMMAND_BUF_DUMMY; +struct CommandBufArea_ __attribute__((aligned(0x20), used, section("COMMAND_BUF"))) CommandBufArea; + const void* PCM_Work = (void*)SoundRAM + 0x78000; /* PCM Stream Address */ const uint32_t PCM_WkSize = 0x8000; /* PCM Stream Size */ const void* SlaveStack = (void*)0x06001e00; /* SlaveSH2 StackPointer */ @@ -36,7 +42,7 @@ const void* SpriteBuf = WorkArea.SpriteBuf; const uint32_t SpriteBufSize = sizeof(WorkArea.SpriteBuf); const void* Pbuffer = WorkArea.Pbuffer; const void* CLOfstBuf = WorkArea.CLOfstBuf; -const void* CommandBuf = WorkArea.CommandBuf; +const void* CommandBuf = CommandBufArea.CommandBuf; // #define SGL_MAX_EVENTS 64 /* number of events that can be used */ const uint16_t EventSize = sizeof(EVENT); diff --git a/modules/sgl/sgl.linker b/modules/sgl/sgl.linker index 7f08d02c..f9079e7b 100644 --- a/modules/sgl/sgl.linker +++ b/modules/sgl/sgl.linker @@ -1,4 +1,4 @@ -OUTPUT_FORMAT(coff-sh) +OUTPUT_FORMAT(elf32-sh) SECTIONS { PRELOADER 0x06004000 : { @@ -13,19 +13,14 @@ SECTIONS { .text ALIGN(0x20) : { - * (.text*) + *(.text) + *(.text*) *(.strings*) *("SEGA_P") - *(.eh_frame_hdr*) - *(.eh_frame*) __etext = .; } - COMMON ALIGN(0x10): { - *(COMMON) - } - SLPROG ALIGN(0x20): { __slprog_start = .; *(SLPROG) @@ -44,40 +39,76 @@ SECTIONS { .data ALIGN(0x10): { - * (.data*) + *(.data) + *(.data*) + . = ALIGN(0x10); __edata = . ; } .rodata ALIGN(0x20) : { + *(.rodata) *(.rodata*) } - .bss ALIGN(0x10) (NOLOAD): + .bss ALIGN(0x10): { __bstart = . ; + *(.bss) *(.bss*) + *(COMMON) . = ALIGN(0x10); __bend = . ; - _end = .; } - HEAP ALIGN(0x10)(NOLOAD): + HEAP ALIGN(0x20): { __heap_start = .; } - WORK_AREA_DUMMY 0x0000000(NOLOAD): + COMMAND_BUF_DUMMY 0x0000000 (NOLOAD): ALIGN(0x20) + { + *(COMMAND_BUF_DUMMY) + . = ALIGN(0x20); + } + + WORK_AREA_DUMMY 0x0000000 (NOLOAD): ALIGN(0x20) { *(WORK_AREA_DUMMY) + . = ALIGN(0x1000); } - work_area_start = ALIGN(0x060FC000 - SIZEOF(WORK_AREA_DUMMY), 0x1000); + command_buf_start = ALIGN(0x060FB800 - SIZEOF(COMMAND_BUF_DUMMY), 0x20); + work_area_start = ALIGN(command_buf_start - SIZEOF(WORK_AREA_DUMMY), 0x1000); - WORK_AREA work_area_start (NOLOAD): - { + WORK_AREA work_area_start : { __heap_end = .; + __work_area_start = .; *(WORK_AREA) __work_area_end = .; } + + COMMAND_BUF command_buf_start : { + __command_buffer_start = .; + *(COMMAND_BUF) + __command_buffer_end = .; + } + + SYSTEM_START 0x060FB800 : { + __systemStart = .; + } + + SYSTEM_END 0x060FFC00 : { + __systemEnd = .; + _end = .; + } + + /DISCARD/ : + { + *(.rela*) + *(.rel.text .rel.data .rel.rodata) + *(.rela.text .rela.data .rela.rodata) + *(.rela.text.* .rela.data.*) + *(.eh_frame) + } } diff --git a/saturnringlib/shared.mk b/saturnringlib/shared.mk index b97f7762..92c0c850 100644 --- a/saturnringlib/shared.mk +++ b/saturnringlib/shared.mk @@ -170,6 +170,13 @@ else SYSFLAGS += -DSGL_MAX_WORKS=256 endif +# Set slave command buffer size, use 70k by default, should be aligned to 0x10 +ifneq ($(strip ${SGL_SLAVE_BUF_SIZE}),) + SYSFLAGS += -DSGL_SLAVE_BUF_SIZE=$(strip ${SGL_SLAVE_BUF_SIZE}) +else + SYSFLAGS += -DSGL_SLAVE_BUF_SIZE=71680 +endif + # Add custom FLAGS ifneq ($(strip ${SRL_CUSTOM_CCFLAGS}),) CCFLAGS += $(strip ${SRL_CUSTOM_CCFLAGS}) @@ -252,10 +259,10 @@ compile_objects : $(OBJECTS) $(SYSOBJECTS) @test -f $(ASSETS_DIR)/ABS.TXT || echo "NOT Abstracted by SEGA" >> $(ASSETS_DIR)/ABS.TXT @test -f $(ASSETS_DIR)/BIB.TXT || echo "NOT Bibliographiced by SEGA" >> $(ASSETS_DIR)/BIB.TXT @test -f $(ASSETS_DIR)/CPY.TXT || touch $(ASSETS_DIR)/CPY.TXT - $(CC) $(LDFLAGS) $(SYSOBJECTS) $(OBJECTS) $(LIBS) -o "$(BUILD_ELF)" + $(CC) $(LDFLAGS) $(SYSOBJECTS) $(OBJECTS) -Wl,-bcoff-sh $(LIBS) -Wl,-belf32-sh -o "$(BUILD_ELF)" convert_binary : compile_objects - $(OBJCOPY) -O binary "$(BUILD_ELF)" ./cd/data/0.bin + $(OBJCOPY) -O binary -R WORK_AREA* -R COMMAND_BUF* -R SYSTEM_START* -R SYSTEM_END* "$(BUILD_ELF)" ./cd/data/0.bin create_iso : convert_binary ifeq ($(strip ${SRL_USE_SGL_SOUND_DRIVER}),1) diff --git a/saturnringlib/srl_base.hpp b/saturnringlib/srl_base.hpp index 5bbda695..3450d8bd 100644 --- a/saturnringlib/srl_base.hpp +++ b/saturnringlib/srl_base.hpp @@ -47,6 +47,39 @@ namespace std { while (1); } + + /** @brief Minimal std::__throw_bad_alloc handler + * + * This function is a minimal implementation to prevent compilation errors + * when the standard library expects a length error handler. It enters an + * infinite loop to prevent undefined behavior. + */ + inline void __throw_bad_alloc() + { + while(1); + } + + /** @brief Minimal std::__throw_bad_array_new_length handler + * + * This function is a minimal implementation to prevent compilation errors + * when the standard library expects a length error handler. It enters an + * infinite loop to prevent undefined behavior. + */ + inline void __throw_bad_array_new_length() + { + while(1); + } + + /** @brief Minimal std::__throw_bad_function_call handler + * + * This function is a minimal implementation to prevent compilation errors + * when the standard library expects a length error handler. It enters an + * infinite loop to prevent undefined behavior. + */ + inline void __throw_bad_function_call() + { + while(1); + } } /** * @brief Minimal pure virtual function handler diff --git a/saturnringlib/srl_memory.hpp b/saturnringlib/srl_memory.hpp index c725d6e0..e38033a9 100644 --- a/saturnringlib/srl_memory.hpp +++ b/saturnringlib/srl_memory.hpp @@ -1,6 +1,7 @@ #pragma once #include "srl_base.hpp" +#include extern "C" { extern char _heap_start; @@ -437,7 +438,7 @@ namespace SRL /** @brief Main system memory zone * @note This is assigned on system initialization */ - inline static MemoryZone zone; + inline static std::optional zone; /** @brief Full main system memory zone */ @@ -451,17 +452,17 @@ namespace SRL auto size = reinterpret_cast(&_heap_end) - reinterpret_cast(&_heap_start); #if defined(USE_TLSF_ALLOCATOR) - HighWorkRam::zone = Memory::MemoryZone + HighWorkRam::zone.emplace(Memory::MemoryZone { tlsf_create_with_pool(address, size), size - }; + }); #else - HighWorkRam::zone = Memory::MemoryZone + HighWorkRam::zone.emplace(Memory::MemoryZone { Memory::SimpleMalloc::InitializeZone(address, size), size - }; + }); #endif } @@ -491,9 +492,9 @@ namespace SRL static void Free(void* ptr) { #if defined(USE_TLSF_ALLOCATOR) - tlsf_free(Memory::HighWorkRam::zone.Address, ptr); + tlsf_free(Memory::HighWorkRam::zone->Address, ptr); #else - Memory::SimpleMalloc::Free(HighWorkRam::zone, ptr); + Memory::SimpleMalloc::Free(HighWorkRam::zone.value(), ptr); #endif } @@ -504,9 +505,9 @@ namespace SRL static void* Malloc(size_t size) { #if defined(USE_TLSF_ALLOCATOR) - return tlsf_malloc(Memory::HighWorkRam::zone.Address, size); + return tlsf_malloc(Memory::HighWorkRam::zone->Address, size); #else - return Memory::SimpleMalloc::Malloc(HighWorkRam::zone, size); + return Memory::SimpleMalloc::Malloc(HighWorkRam::zone.value(), size); #endif } @@ -518,9 +519,9 @@ namespace SRL static void* Realloc(void* ptr, size_t size) { #if defined(USE_TLSF_ALLOCATOR) - return tlsf_realloc(Memory::HighWorkRam::zone.Address, ptr, size); + return tlsf_realloc(Memory::HighWorkRam::zone->Address, ptr, size); #else - return Memory::SimpleMalloc::Realloc(HighWorkRam::zone, ptr, size); + return Memory::SimpleMalloc::Realloc(HighWorkRam::zone.value(), ptr, size); #endif } @@ -530,9 +531,9 @@ namespace SRL static size_t GetFreeSpace() { #if defined(USE_TLSF_ALLOCATOR) - return Memory::GetTlsfReport(HighWorkRam::zone).FreeSize; + return Memory::GetTlsfReport(HighWorkRam::zone.value()).FreeSize; #else - return Memory::SimpleMalloc::GetReport(HighWorkRam::zone).FreeSize; + return Memory::SimpleMalloc::GetReport(HighWorkRam::zone.value()).FreeSize; #endif } @@ -542,9 +543,9 @@ namespace SRL static const Report GetReport() { #if defined(USE_TLSF_ALLOCATOR) - return Memory::GetTlsfReport(HighWorkRam::zone); + return Memory::GetTlsfReport(HighWorkRam::zone.value()); #else - return Memory::SimpleMalloc::GetReport(HighWorkRam::zone); + return Memory::SimpleMalloc::GetReport(HighWorkRam::zone.value()); #endif } @@ -553,7 +554,7 @@ namespace SRL */ static size_t GetSize() { - return HighWorkRam::zone.Size; + return HighWorkRam::zone->Size; } /** @brief Gets total size of the used space in the memory zone @@ -562,10 +563,10 @@ namespace SRL static size_t GetUsedSpace() { #if defined(USE_TLSF_ALLOCATOR) - auto report = Memory::GetTlsfReport(HighWorkRam::zone); + auto report = Memory::GetTlsfReport(HighWorkRam::zone.value()); return report.TotalSize - report.FreeSize; #else - auto report = Memory::SimpleMalloc::GetReport(HighWorkRam::zone); + auto report = Memory::SimpleMalloc::GetReport(HighWorkRam::zone.value()); return report.TotalSize - report.FreeSize; #endif } @@ -584,7 +585,7 @@ namespace SRL /** @brief Memory zone */ - inline static Memory::MemoryZone zone; + inline static std::optional zone; /** @brief Initialize memory zone */ @@ -594,17 +595,17 @@ namespace SRL const uint32_t size = 0x100000; #if defined(USE_TLSF_ALLOCATOR) - LowWorkRam::zone = Memory::MemoryZone + LowWorkRam::zone.emplace(Memory::MemoryZone { tlsf_create_with_pool((void*)address, size), size - }; + }); #else - LowWorkRam::zone = Memory::MemoryZone + LowWorkRam::zone.emplace(Memory::MemoryZone { Memory::SimpleMalloc::InitializeZone((void*)address, size), size - }; + }); #endif } @@ -616,7 +617,7 @@ namespace SRL */ inline static bool InRange(void* ptr) { - return Memory::InZone(LowWorkRam::zone, ptr); + return Memory::InZone(LowWorkRam::zone.value(), ptr); } /** @brief Check whether pointer is in range of the memory zone @@ -625,7 +626,7 @@ namespace SRL */ inline static bool InRange(uint32_t zoneAddress) { - return Memory::InZone(LowWorkRam::zone, (void*)zoneAddress); + return Memory::InZone(LowWorkRam::zone.value(), (void*)zoneAddress); } /** @brief Free allocated memory @@ -634,9 +635,9 @@ namespace SRL inline static void Free(void* ptr) { #if defined(USE_TLSF_ALLOCATOR) - tlsf_free(LowWorkRam::zone.Address, ptr); + tlsf_free(LowWorkRam::zone->Address, ptr); #else - Memory::SimpleMalloc::Free(LowWorkRam::zone, ptr); + Memory::SimpleMalloc::Free(LowWorkRam::zone.value(), ptr); #endif } @@ -647,9 +648,9 @@ namespace SRL inline static void* Malloc(size_t size) { #if defined(USE_TLSF_ALLOCATOR) - return tlsf_malloc(LowWorkRam::zone.Address, size); + return tlsf_malloc(LowWorkRam::zone->Address, size); #else - return Memory::SimpleMalloc::Malloc(LowWorkRam::zone, size); + return Memory::SimpleMalloc::Malloc(LowWorkRam::zone.value(), size); #endif } @@ -661,9 +662,9 @@ namespace SRL inline static void* Realloc(void* ptr, size_t size) { #if defined(USE_TLSF_ALLOCATOR) - return tlsf_realloc(LowWorkRam::zone.Address, ptr, size); + return tlsf_realloc(LowWorkRam::zone->Address, ptr, size); #else - return Memory::SimpleMalloc::Realloc(LowWorkRam::zone, ptr, size); + return Memory::SimpleMalloc::Realloc(LowWorkRam::zone.value(), ptr, size); #endif } @@ -673,9 +674,9 @@ namespace SRL static size_t GetFreeSpace() { #if defined(USE_TLSF_ALLOCATOR) - return Memory::GetTlsfReport(LowWorkRam::zone).FreeSize; + return Memory::GetTlsfReport(LowWorkRam::zone.value()).FreeSize; #else - return Memory::SimpleMalloc::GetReport(LowWorkRam::zone).FreeSize; + return Memory::SimpleMalloc::GetReport(LowWorkRam::zone.value()).FreeSize; #endif } @@ -685,9 +686,9 @@ namespace SRL static const Report GetReport() { #if defined(USE_TLSF_ALLOCATOR) - return Memory::GetTlsfReport(LowWorkRam::zone); + return Memory::GetTlsfReport(LowWorkRam::zone.value()); #else - return Memory::SimpleMalloc::GetReport(LowWorkRam::zone); + return Memory::SimpleMalloc::GetReport(LowWorkRam::zone.value()); #endif } @@ -696,7 +697,7 @@ namespace SRL */ inline static size_t GetSize() { - return LowWorkRam::zone.Size; + return LowWorkRam::zone->Size; } /** @brief Gets total size of the used space in the memory zone @@ -705,9 +706,9 @@ namespace SRL static size_t GetUsedSpace() { #if defined(USE_TLSF_ALLOCATOR) - auto report = Memory::GetTlsfReport(LowWorkRam::zone); + auto report = Memory::GetTlsfReport(LowWorkRam::zone.value()); #else - auto report = Memory::SimpleMalloc::GetReport(LowWorkRam::zone); + auto report = Memory::SimpleMalloc::GetReport(LowWorkRam::zone.value()); #endif return report.TotalSize - report.FreeSize; } @@ -725,7 +726,7 @@ namespace SRL /** @brief Memory zone */ - inline static Memory::MemoryZone zone; + inline static std::optional zone; /** @brief Initialize memory zone */