Skip to content

Commit f72fffd

Browse files
committed
function rename _add_sdram_to_heap and small refactoring
1 parent 6ac1e5b commit f72fffd

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

ports/stm/boards/daisy_seed_with_sdram/board.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#include STM32_HAL_H
77

88
#include "supervisor/board.h"
9+
#include "supervisor/stm.h"
910
#include "sdram.h"
1011

11-
extern void port_add_sdram_to_heap(void);
1212

1313
/** SDRAM banks configuration. */
1414
static const struct stm32_sdram_bank_config bank_config[] = {
@@ -38,7 +38,7 @@ static const struct stm32_sdram_bank_config bank_config[] = {
3838
/* SDRAM configuration. */
3939
static const struct stm32_sdram_config config = {
4040
.sdram = FMC_SDRAM_DEVICE,
41-
.power_up_delay = 0,
41+
.power_up_delay = 100,
4242
.num_auto_refresh = 8,
4343
.mode_register = SDRAM_MODEREG_BURST_LENGTH_4 |
4444
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
@@ -56,5 +56,5 @@ static const struct stm32_sdram_config config = {
5656
void board_init(void) {
5757
sdram_init(&config);
5858
// sdram_test(true);
59-
port_add_sdram_to_heap();
59+
stm_add_sdram_to_heap();
6060
}

ports/stm/peripherals/sdram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static void sdram_init_seq(const struct stm32_sdram_config *config) {
144144
command.CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
145145
HAL_SDRAM_SendCommand(&hsdram, &command, HAL_MAX_DELAY);
146146

147-
HAL_Delay(100);
147+
HAL_Delay(config->power_up_delay);
148148

149149
/* Configure a PALL (precharge all) command */
150150
command.CommandMode = FMC_SDRAM_CMD_PALL;

ports/stm/supervisor/port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void NVIC_SystemReset(void) NORETURN;
4343

4444
#if (CPY_STM32H7) || (CPY_STM32F7)
4545
#if defined(CIRCUITPY_HW_SDRAM_SIZE)
46+
#include "stm.h"
4647
#include "sdram.h"
4748
#include <stdbool.h>
4849
#include <stddef.h>
@@ -184,7 +185,7 @@ void port_heap_init(void) {
184185
// heap init in _port_heap_init called from port_init
185186
}
186187

187-
void port_add_sdram_to_heap(void) {
188+
void stm_add_sdram_to_heap(void) {
188189
size_t sdram_memory_size = sdram_size();
189190
pools[1] = tlsf_add_pool(_heap, sdram_start(), sdram_memory_size);
190191
}

ports/stm/supervisor/stm.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2025 snkYmkrct
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
10+
void stm_add_sdram_to_heap(void);

0 commit comments

Comments
 (0)