Change linker script and startup code.

This is my own code from my template. It is much cleaner than the old code.
This commit is contained in:
2020-08-21 23:25:03 +02:00
parent 95de84fa85
commit ec117e0627
14 changed files with 493 additions and 738 deletions

View File

@@ -115,7 +115,7 @@ static inline void setup_shell_uart(struct stm_uart *uart)
static bool mount_sd_card_if_avail(bool mounted)
{
FRESULT res;
static uint8_t IN_SECTION(.ccmram) inserted_counter = 0;
static uint8_t IN_SECTION(.ccm.bss) inserted_counter = 0;
if (sdio_check_inserted() && mounted) {
memset(fs_ptr, 0, sizeof(FATFS));
@@ -185,20 +185,6 @@ static void handle_shell_uart_input(shellmatta_handle_t shell_handle)
shell_handle_input(shell_handle, uart_input, uart_input_len);
}
static void zero_ccm_ram(void)
{
/* These extern variables are placed in the linker script */
extern char _sccmram;
extern char _eccmram;
uint32_t len;
uint32_t i;
uint32_t *ptr = (uint32_t *)&_sccmram;
len = (uint32_t)&_eccmram - (uint32_t)&_sccmram;
for (i = 0; i < len; i++)
ptr[i] = 0UL;
}
int main(void)
{
bool cal_active;
@@ -210,7 +196,6 @@ int main(void)
shellmatta_handle_t shell_handle;
int menu_wait_request;
uint64_t quarter_sec_timestamp = 0ULL;
zero_ccm_ram();
setup_system();
shell_handle = shell_init(write_shell_callback);