Skip to content

Commit

Permalink
fixed memory sharing between dlog view and ext. assets
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 16, 2020
1 parent 6e6e748 commit 187d550
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
12 changes: 5 additions & 7 deletions src/eez/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static const uint32_t MEMORY_SIZE = 64 * 1024 * 1024;

static uint8_t * const DECOMPRESSED_ASSETS_START_ADDRESS = MEMORY_BEGIN;
#if defined(EEZ_PLATFORM_STM32)
static const uint32_t DECOMPRESSED_ASSETS_SIZE = 3 * 512 * 1024;
static const uint32_t DECOMPRESSED_ASSETS_SIZE = (3 * 512 - 20) * 1024;
#endif
#if defined(EEZ_PLATFORM_SIMULATOR)
static const uint32_t DECOMPRESSED_ASSETS_SIZE = 8 * 1024 * 1024;
Expand All @@ -54,8 +54,8 @@ static const uint32_t FILE_VIEW_BUFFER_SIZE = 1024 * 1024;
static const uint32_t FILE_VIEW_BUFFER_SIZE = 3 * 512 * 1024;
#endif

static uint8_t * const EXTERNAL_ASSETS_BUFFER = FILE_VIEW_BUFFER;
static const uint32_t EXTERNAL_ASSETS_BUFFER_SIZE = FILE_VIEW_BUFFER_SIZE;
static uint8_t * const EXTERNAL_ASSETS_BUFFER = FILE_VIEW_BUFFER + FILE_VIEW_BUFFER_SIZE;
static const uint32_t EXTERNAL_ASSETS_BUFFER_SIZE = 1024 * 1024;

static uint8_t * const MP_BUFFER = EXTERNAL_ASSETS_BUFFER + EXTERNAL_ASSETS_BUFFER_SIZE;
static const uint32_t MP_BUFFER_SIZE = 512 * 1024;
Expand Down Expand Up @@ -102,9 +102,7 @@ static uint8_t * const VRAM_AUX_BUFFER3_START_ADDRESS = VRAM_AUX_BUFFER2_START_A
static uint8_t * const VRAM_AUX_BUFFER4_START_ADDRESS = VRAM_AUX_BUFFER3_START_ADDRESS + VRAM_BUFFER_SIZE;
static uint8_t * const VRAM_AUX_BUFFER5_START_ADDRESS = VRAM_AUX_BUFFER4_START_ADDRESS + VRAM_BUFFER_SIZE;
static uint8_t * const VRAM_AUX_BUFFER6_START_ADDRESS = VRAM_AUX_BUFFER5_START_ADDRESS + VRAM_BUFFER_SIZE;
static uint8_t * const VRAM_AUX_BUFFER7_START_ADDRESS = VRAM_AUX_BUFFER6_START_ADDRESS + VRAM_BUFFER_SIZE;
static uint8_t * const VRAM_AUX_BUFFER8_START_ADDRESS = VRAM_AUX_BUFFER7_START_ADDRESS + VRAM_BUFFER_SIZE;

static uint8_t * const VRAM_AUX_BUFFER9_START_ADDRESS = VRAM_AUX_BUFFER8_START_ADDRESS + VRAM_BUFFER_SIZE;
static uint8_t * const VRAM_AUX_BUFFER7_START_ADDRESS = VRAM_AUX_BUFFER6_START_ADDRESS + VRAM_BUFFER_SIZE;

static uint8_t * const MEMORY_END = VRAM_AUX_BUFFER9_START_ADDRESS + VRAM_BUFFER_SIZE;
static uint8_t * const MEMORY_END = VRAM_AUX_BUFFER7_START_ADDRESS + VRAM_BUFFER_SIZE;
2 changes: 1 addition & 1 deletion src/eez/modules/mcu/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int getCursorXPosition(int cursorPosition, const char *text, int textLength, int
int8_t measureGlyph(uint8_t encoding, gui::font::Font &font);
int measureStr(const char *text, int textLength, gui::font::Font &font, int max_width = 0);

static const int NUM_BUFFERS = 8;
static const int NUM_BUFFERS = 6;
struct BufferFlags {
unsigned allocated : 1;
unsigned used : 1;
Expand Down
2 changes: 0 additions & 2 deletions src/eez/modules/mcu/simulator/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ void turnOn() {
g_buffers[3].bufferPointer = (uint32_t *)VRAM_AUX_BUFFER4_START_ADDRESS;
g_buffers[4].bufferPointer = (uint32_t *)VRAM_AUX_BUFFER5_START_ADDRESS;
g_buffers[5].bufferPointer = (uint32_t *)VRAM_AUX_BUFFER6_START_ADDRESS;
g_buffers[6].bufferPointer = (uint32_t *)VRAM_AUX_BUFFER7_START_ADDRESS;
g_buffers[7].bufferPointer = (uint32_t *)VRAM_AUX_BUFFER8_START_ADDRESS;

refreshScreen();
}
Expand Down
4 changes: 1 addition & 3 deletions src/eez/modules/mcu/stm32/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void fillRect(uint16_t *dst, int x, int y, int width, int height, uint16_t color
HAL_DMA2D_Start(&hdma2d, colorBGRA, vramOffset(dst, x, y), width, height);
} else {
// fill aux. buffer with BGRA color
auto auxBuffer = (uint32_t *)VRAM_AUX_BUFFER9_START_ADDRESS;
auto auxBuffer = (uint32_t *)VRAM_AUX_BUFFER7_START_ADDRESS;

hdma2d.Init.Mode = DMA2D_R2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
Expand Down Expand Up @@ -385,8 +385,6 @@ void turnOn() {
g_buffers[3].bufferPointer = (uint16_t *)(VRAM_AUX_BUFFER4_START_ADDRESS);
g_buffers[4].bufferPointer = (uint16_t *)(VRAM_AUX_BUFFER5_START_ADDRESS);
g_buffers[5].bufferPointer = (uint16_t *)(VRAM_AUX_BUFFER6_START_ADDRESS);
g_buffers[6].bufferPointer = (uint16_t *)(VRAM_AUX_BUFFER7_START_ADDRESS);
g_buffers[7].bufferPointer = (uint16_t *)(VRAM_AUX_BUFFER8_START_ADDRESS);

fillRect(g_bufferOld, 0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, 0);
fillRect(g_bufferNew, 0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/third_party/stm32_cubeide/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ void SystemClock_Config(void)
#endif
|RCC_PERIPHCLK_SDMMC1|RCC_PERIPHCLK_CLK48;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 200;
#if CONF_OPTION_FPGA
PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
#else
PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
#endif
PeriphClkInitStruct.PLLSAI.PLLSAIQ = 2;
PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV2;
PeriphClkInitStruct.PLLSAIDivQ = 1;
Expand Down

0 comments on commit 187d550

Please sign in to comment.