Skip to content

File sdram.h

File List > dev > sdram.h

Go to the documentation of this file

Source Code

//Edit the Linker Script to have the following lines in the following sections:
/*
MEMORY
{
    SDRAM (RWX) : ORIGIN = 0xC0000000, LENGTH = 64M
}
SECTIONS
{

    .sdram_data :
    {
        . = ALIGN(4);
        _ssdram_data = .;


        PROVIDE(__sdram_data_start = _ssdram_data);
        *(.sdram_data)
        *(.sdram_data*)
        . = ALIGN(4);
        _esdram_data = .;

        PROVIDE(__sdram_data_end = _esdram_data);
     } > SDRAM AT >FLASH
     _sisdram_data = LOADADDR(.sdram_data);


    .sdram_bss (NOLOAD):
    {
        . = ALIGN(4);
        __ssdram_bss = .;
        PROVIDE(__sdram_bss_start = _ssdram_bss);
        *(.sdram_bss)
        *(.sdram_bss*)
        . = ALIGN(4);
        _esdram_bss = .;


        PROVIDE(__sdram_bss_end = _esdram_bss);

     } > SDRAM
}
*/
#ifndef RAM_AS4C16M16SA_H
#define RAM_AS4C16M16SA_H 
#include <stdint.h>
#include "daisy_core.h"

/*
    As mentioned above, this does not currently initialize correctly (startup
    code needs to be modified to init SDRAM, and fill
    The variables placed here will also need to fit inside of the flash in order to initialize.
  */

#define DSY_SDRAM_DATA __attribute__((section(".sdram_data")))


#define DSY_SDRAM_BSS __attribute__((section(".sdram_bss")))

class SdramHandle
{
  public:
    enum class Result
    {
        OK,  
        ERR, 
    };

    Result Init();
    Result DeInit();

  private:
    Result PeriphInit();
    Result DeviceInit();
    Result PeriphDeInit();
    Result DeviceDeInit();
};
#endif