fusee-primary: move BCT0 buffer to dram to save on iram

Add dram section to link script, and also creates a framebuffer section so we
can start to use the link script as a single source of truth for how
fusee-primary uses dram.
This commit is contained in:
misson20000 2020-10-18 15:26:09 -07:00
parent 4499c4392d
commit c00c30c751
3 changed files with 18 additions and 4 deletions

View file

@ -15,6 +15,7 @@ MEMORY
NULL : ORIGIN = 0x00000000, LENGTH = 0x1000
main : ORIGIN = 0x40010000, LENGTH = 0x20000
low_iram : ORIGIN = 0x40003000, LENGTH = 0x8000
dram : ORIGIN = 0xC0000000, LENGTH = 0x40000000
}
SECTIONS
@ -150,6 +151,16 @@ SECTIONS
} >main :NONE
__end__ = ABSOLUTE(.) ;
.dram (NOLOAD) :
{
. = ALIGN(32);
PROVIDE (__dram_start__ = ABSOLUTE(.));
*(.framebuffer)
*(.dram)
. = ALIGN(32);
PROVIDE (__dram_end__ = ABSOLUTE(.));
} >dram :NONE
/* ==================
==== Metadata ====
================== */

View file

@ -179,6 +179,8 @@ void config_se_brom()
pmc->reset_status = 0;
}
extern uint8_t __dram_start__[], __dram_end__[];
void nx_hwinit()
{
volatile tegra_pmc_t *pmc = pmc_get_regs();
@ -291,6 +293,9 @@ void nx_hwinit()
/* Initialize SDRAM. */
sdram_init();
/* Zero-fill the .dram section */
memset(__dram_start__, 0, __dram_end__ - __dram_start__);
/* Save SDRAM LP0 parameters. */
sdram_lp0_save_params(sdram_get_params());

View file

@ -32,8 +32,8 @@
extern void (*__program_exit_callback)(int rc);
static void *g_framebuffer;
static char g_bct0_buffer[BCTO_MAX_SIZE];
static uint32_t g_framebuffer[1280*768] __attribute__((section(".framebuffer"))) = {0};
static char g_bct0_buffer[BCTO_MAX_SIZE] __attribute__((section(".dram"))) = {0};
#define CONFIG_LOG_LEVEL_KEY "log_level"
@ -91,8 +91,6 @@ static int config_ini_handler(void *user, const char *section, const char *name,
}
static void setup_display(void) {
g_framebuffer = (void *)0xC0000000;
/* Zero-fill the framebuffer and register it as printk provider. */
video_init(g_framebuffer);