mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
SAMA5D4-EK: Updates to get the at25boot configuration building correctly
This commit is contained in:
@@ -2,19 +2,23 @@ AIC Advanced Interrupt Controller (Atmel SAM)
|
|||||||
ADC Analog to Digital Conversion
|
ADC Analog to Digital Conversion
|
||||||
ARP Address Resolution Protocol (networking)
|
ARP Address Resolution Protocol (networking)
|
||||||
BCH Block to Character
|
BCH Block to Character
|
||||||
|
BINFMT Binary Format (Dynamic Loader)
|
||||||
CAN Controller Area Network
|
CAN Controller Area Network
|
||||||
|
CP15 Coprocessor 15 (ARM)
|
||||||
DEVIF Device Interface (networking)
|
DEVIF Device Interface (networking)
|
||||||
DAC Digital to Analog Conversion
|
DAC Digital to Analog Conversion
|
||||||
DEV Device
|
DEV Device
|
||||||
DRAM Dynamic RAM
|
DRAM Dynamic RAM
|
||||||
FAT File Allocation Table
|
FAT File Allocation Table
|
||||||
FTL FLASH Translation Layer
|
FTL FLASH Translation Layer
|
||||||
|
IRQ Interrupt Request
|
||||||
I2C Inter-Integrated Circuit
|
I2C Inter-Integrated Circuit
|
||||||
I2S Inter IC Sound
|
I2S Inter IC Sound
|
||||||
ICMP Internet Control Message Protocol (networking)
|
ICMP Internet Control Message Protocol (networking)
|
||||||
IOB I/O Buffer (networking)
|
IOB I/O Buffer (networking)
|
||||||
LIBC The "C" Library
|
LIBC The "C" Library
|
||||||
MM Memory Management/Manager
|
MM Memory Management/Manager
|
||||||
|
MMAP Memory Map
|
||||||
MMC Multi-Media Card
|
MMC Multi-Media Card
|
||||||
MMCSD See MMC and SD
|
MMCSD See MMC and SD
|
||||||
MTD Memory Technology Device
|
MTD Memory Technology Device
|
||||||
|
|||||||
@@ -616,8 +616,19 @@
|
|||||||
# endif
|
# endif
|
||||||
# define PGTABLE_IN_HIGHSRAM 1
|
# define PGTABLE_IN_HIGHSRAM 1
|
||||||
|
|
||||||
|
/* If we execute from SRAM but keep data in SDRAM, then we will also have
|
||||||
|
* to position the initial, IDLE stack in SRAM. SDRAM will not be ready
|
||||||
|
* soon enough to serve as the stack.
|
||||||
|
*
|
||||||
|
* In this case, the initial IDLE stack can just follow the vector table,
|
||||||
|
* lying between the vector table and the page table. We don't really
|
||||||
|
* know how much memory to set aside for the vector table, but 4KiB should
|
||||||
|
* be much more than enough
|
||||||
|
*/
|
||||||
|
|
||||||
# ifdef CONFIG_BOOT_SDRAM_DATA
|
# ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
# error CONFIG_BOOT_SDRAM_DATA not suupported in this configuration
|
# define IDLE_STACK_PBASE (SAM_ISRAM0_PADDR + 0x0001000)
|
||||||
|
# define IDLE_STACK_VBASE (SAM_ISRAM0_VADDR + 0x0001000)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# else /* CONFIG_SAMA5_BOOT_ISRAM && CONFIG_ARCH_LOWVECTORS */
|
# else /* CONFIG_SAMA5_BOOT_ISRAM && CONFIG_ARCH_LOWVECTORS */
|
||||||
@@ -657,7 +668,13 @@
|
|||||||
# error "One of PGTABLE_BASE_PADDR or PGTABLE_BASE_VADDR is undefined"
|
# error "One of PGTABLE_BASE_PADDR or PGTABLE_BASE_VADDR is undefined"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* If data is in SDRAM, then the IDLE stack at the beginning of ISRAM */
|
/* If we execute from SRAM but keep data in SDRAM, then we will also have
|
||||||
|
* to position the initial, IDLE stack in SRAM. SDRAM will not be ready
|
||||||
|
* soon enough to serve as the stack.
|
||||||
|
*
|
||||||
|
* In this case, the initial IDLE stack can just follow the page table
|
||||||
|
* in ISRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
# ifdef CONFIG_BOOT_SDRAM_DATA
|
# ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
# define IDLE_STACK_PBASE (SAM_ISRAM0_PADDR + PGTABLE_SIZE)
|
# define IDLE_STACK_PBASE (SAM_ISRAM0_PADDR + PGTABLE_SIZE)
|
||||||
|
|||||||
@@ -608,8 +608,19 @@
|
|||||||
# endif
|
# endif
|
||||||
# define PGTABLE_IN_HIGHSRAM 1
|
# define PGTABLE_IN_HIGHSRAM 1
|
||||||
|
|
||||||
|
/* If we execute from SRAM, but keep data in SDRAM, then we will also have
|
||||||
|
* to position the initial, IDLE stack in SRAM. SDRAM will not be ready
|
||||||
|
* soon enough to serve as the stack.
|
||||||
|
*
|
||||||
|
* In this case, the initial IDLE stack can just follow the vector table,
|
||||||
|
* lying between the vector table and the page table. We don't really
|
||||||
|
* know how much memory to set aside for the vector table, but 4KiB should
|
||||||
|
* be much more than enough
|
||||||
|
*/
|
||||||
|
|
||||||
# ifdef CONFIG_BOOT_SDRAM_DATA
|
# ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
# error CONFIG_BOOT_SDRAM_DATA not suupported in this configuration
|
# define IDLE_STACK_PBASE (SAM_ISRAM0_PADDR + 0x0001000)
|
||||||
|
# define IDLE_STACK_VBASE (SAM_ISRAM0_VADDR + 0x0001000)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# else /* CONFIG_SAMA5_BOOT_ISRAM && CONFIG_ARCH_LOWVECTORS */
|
# else /* CONFIG_SAMA5_BOOT_ISRAM && CONFIG_ARCH_LOWVECTORS */
|
||||||
@@ -625,6 +636,14 @@
|
|||||||
# endif
|
# endif
|
||||||
# define PGTABLE_IN_LOWSRAM 1
|
# define PGTABLE_IN_LOWSRAM 1
|
||||||
|
|
||||||
|
/* If we execute from SRAM, but keep data in SDRAM, then we will also have
|
||||||
|
* to position the initial, IDLE stack in SRAM. SDRAM will not be ready
|
||||||
|
* soon enough to serve as the stack.
|
||||||
|
*
|
||||||
|
* In this case, the initial IDLE stack can just follow the page table
|
||||||
|
* in ISRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
# ifdef CONFIG_BOOT_SDRAM_DATA
|
# ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
# define IDLE_STACK_PBASE (PGTABLE_BASE_PADDR + PGTABLE_SIZE)
|
# define IDLE_STACK_PBASE (PGTABLE_BASE_PADDR + PGTABLE_SIZE)
|
||||||
# define IDLE_STACK_VBASE (PGTABLE_BASE_VADDR + PGTABLE_SIZE)
|
# define IDLE_STACK_VBASE (PGTABLE_BASE_VADDR + PGTABLE_SIZE)
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ CONFIG_RAM_START=0x00200000
|
|||||||
CONFIG_RAM_VSTART=0x00200000
|
CONFIG_RAM_VSTART=0x00200000
|
||||||
CONFIG_RAM_SIZE=114688
|
CONFIG_RAM_SIZE=114688
|
||||||
CONFIG_ARCH_HAVE_SDRAM=y
|
CONFIG_ARCH_HAVE_SDRAM=y
|
||||||
CONFIG_BOOT_SDRAM_DATA=y
|
# CONFIG_BOOT_SDRAM_DATA is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Board Selection
|
# Board Selection
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ ifeq ($(CONFIG_SAMA5D4EK_DRAM_MAIN),y)
|
|||||||
CSRCS += dram_main.c
|
CSRCS += dram_main.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SAMA5D4EK_AT25_MAIN),y)
|
||||||
|
CSRCS += at25_main.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MTD_AT25),y)
|
ifeq ($(CONFIG_MTD_AT25),y)
|
||||||
ifeq ($(CONFIG_SAMA5_SPI0),y)
|
ifeq ($(CONFIG_SAMA5_SPI0),y)
|
||||||
CSRCS += sam_at25.c
|
CSRCS += sam_at25.c
|
||||||
|
|||||||
@@ -40,9 +40,15 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/streams.h>
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include <apps/hex2bin.h>
|
#include <apps/hex2bin.h>
|
||||||
|
|
||||||
@@ -57,19 +63,19 @@
|
|||||||
# error The AT25 Serial FLASH is not available
|
# error The AT25 Serial FLASH is not available
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_SAMA5D4EK_NAND_AUTOMOUNT
|
#ifndef CONFIG_SAMA5D4EK_AT25_AUTOMOUNT
|
||||||
# error CONFIG_SAMA5D4EK_NAND_AUTOMOUNT must be selected
|
# error CONFIG_SAMA5D4EK_AT25_AUTOMOUNT must be selected
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_SAMA5D4EK_AT25_CHARDEV
|
#ifndef CONFIG_SAMA5D4EK_AT25_CHARDEV
|
||||||
# error CONFIG_SAMA5D4EK_AT25_CHARDEV must be selected
|
# error CONFIG_SAMA5D4EK_AT25_CHARDEV must be selected
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_BOOT_SDRAM_DATA
|
#ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
# error CONFIG_BOOT_SDRAM_DATA must be selected
|
# error CONFIG_BOOT_SDRAM_DATA must NOT be selected
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SAMA5D4EK_AT25_PROGSIZE) || CONFIG_SAMA5D4EK_AT25_PROGSIZE < 128
|
#if !defined(CONFIG_SAMA5D4EK_AT25_PROGSIZE) || CONFIG_SAMA5D4EK_AT25_PROGSIZE < 128
|
||||||
# error Large CONFIG_SAMA5D4EK_AT25_PROGSIZE must be selected
|
# error Large CONFIG_SAMA5D4EK_AT25_PROGSIZE must be selected
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -84,9 +90,8 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static uint8_t g_heximage[CONFIG_SAMA5D4EK_AT25_PROGSIZE];
|
|
||||||
static uint8_t g_iobuffer[IOBUFFER_SIZE];
|
static uint8_t g_iobuffer[IOBUFFER_SIZE];
|
||||||
statid uint8_t g_at25dev[DEVNAME_MAXSIZE];
|
static char g_at25dev[DEVNAME_MAXSIZE];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@@ -149,11 +154,12 @@ int at25_main(int argc, char *argv)
|
|||||||
|
|
||||||
lib_rawinstream(&rawinstream, 0);
|
lib_rawinstream(&rawinstream, 0);
|
||||||
|
|
||||||
/* Wrap the memory buffer as a seek-able OUT stream in which we can buffer
|
/* Define a memory buffer of size CONFIG_SAMA5D4EK_AT25_PROGSIZE at the
|
||||||
* the binary data.
|
* beginning of SDRAM. Wrap the memory buffer as a seek-able OUT stream in
|
||||||
|
* which we can buffer the binary data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lib_memsostream(&memoutstream, (FAR char *)g_heximage,
|
lib_memsostream(&memoutstream, (FAR char *)SAM_DDRCS_VSECTION,
|
||||||
CONFIG_SAMA5D4EK_AT25_PROGSIZE);
|
CONFIG_SAMA5D4EK_AT25_PROGSIZE);
|
||||||
|
|
||||||
/* We are ready to load the Intel HEX stream into DRAM.
|
/* We are ready to load the Intel HEX stream into DRAM.
|
||||||
@@ -186,7 +192,7 @@ int at25_main(int argc, char *argv)
|
|||||||
memoutstream.public.nput);
|
memoutstream.public.nput);
|
||||||
|
|
||||||
remaining = memoutstream.public.nput;
|
remaining = memoutstream.public.nput;
|
||||||
dest = g_heximage;
|
dest = (uint8_t *)CONFIG_SAMA5D4EK_AT25_PROGSIZE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -229,7 +235,7 @@ int at25_main(int argc, char *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
remaining = memoutstream.public.nput;
|
remaining = memoutstream.public.nput;
|
||||||
src = g_heximage;
|
src = (const uint8_t *)CONFIG_SAMA5D4EK_AT25_PROGSIZE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ int sam_at25_automount(int minor)
|
|||||||
FAR struct spi_dev_s *spi;
|
FAR struct spi_dev_s *spi;
|
||||||
FAR struct mtd_dev_s *mtd;
|
FAR struct mtd_dev_s *mtd;
|
||||||
#ifdef CONFIG_SAMA5D4EK_AT25_CHARDEV
|
#ifdef CONFIG_SAMA5D4EK_AT25_CHARDEV
|
||||||
uint8_t blockdev[18];
|
char blockdev[18];
|
||||||
uint8_t chardev[12];
|
char chardev[12];
|
||||||
#endif
|
#endif
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user