Page 1 of 1

undefined reference to `HAL_SRAM_Init'

Posted: Sun Oct 31, 2021 8:13 pm
by jay_stm
Setting up the arduino environment for the stm32H743zi2 nucleo board and 16 bit parallel lcd touch screen with nt35510 driver since i cant find a working driver for this combination, trying to minimise the code to the basic, the following code gives me this error:
undefined reference to `HAL_SRAM_Init'



#include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_sram.h"
#include "stm32h7xx_hal_conf_template.h"
#include "stm32h7xx_hal_conf_default.h"

SRAM_HandleTypeDef hsram1;

void setup() {
// put your setup code here, to run once:
HAL_Init();
MX_FMC_Init();
}

void loop() {
// put your main code here, to run repeatedly:
delay(10);
}

/* FMC initialization function */
void MX_FMC_Init(void)
{
FMC_NORSRAM_TimingTypeDef Timing = {0};
FMC_NORSRAM_TimingTypeDef ExtTiming = {0};
hsram1.Instance = FMC_NORSRAM_DEVICE;
hsram1.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
/* hsram1.Init */
hsram1.Init.NSBank = FMC_NORSRAM_BANK1;
hsram1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
hsram1.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
hsram1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_16;
hsram1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE;
hsram1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
hsram1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS;
hsram1.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE;
hsram1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE;
hsram1.Init.ExtendedMode = FMC_EXTENDED_MODE_ENABLE;
hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
hsram1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE;
hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE;
/* Timing */
Timing.AddressSetupTime = 5;
Timing.AddressHoldTime = 15;
Timing.DataSetupTime = 10;
Timing.BusTurnAroundDuration = 15;
Timing.CLKDivision = 16;
Timing.DataLatency = 17;
Timing.AccessMode = FMC_ACCESS_MODE_A;
/* ExtTiming */
ExtTiming.AddressSetupTime = 0;
ExtTiming.AddressHoldTime = 15;
ExtTiming.DataSetupTime = 8;
ExtTiming.BusTurnAroundDuration = 15;
ExtTiming.CLKDivision = 16;
ExtTiming.DataLatency = 17;
ExtTiming.AccessMode = FMC_ACCESS_MODE_A;

if (HAL_SRAM_Init(&hsram1, &Timing, &ExtTiming) != HAL_OK)
{

}
}

Re: undefined reference to `HAL_SRAM_Init'

Posted: Tue Nov 02, 2021 7:36 pm
by jay_stm
ok, figured it out

stm32yyxx_hal_conf.h
add:
#define HAL_SRAM_MODULE_ENABLED

then it compiles without errors, sure there must be a way to get around changing the basic source??

Re: undefined reference to `HAL_SRAM_Init'

Posted: Mon Nov 08, 2021 3:26 pm
by fpiSTM
Yes you can refers to this:
https://github.com/stm32duino/wiki/wiki ... figuration

mainly hal_conf_extra.h