diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-06-28 09:39:50 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-06-28 09:39:50 -0600 |
commit | 5d0227db2d98e2b4ff5d09722c4d194f8efe1813 (patch) | |
tree | ad8debadca9fccfd67fb1700856d41042a67296e /nuttx/configs/sama5d4-ek | |
parent | 6425f53c5e072a5552224b7edbdd7cd0207ba8e3 (diff) | |
download | px4-nuttx-5d0227db2d98e2b4ff5d09722c4d194f8efe1813.tar.gz px4-nuttx-5d0227db2d98e2b4ff5d09722c4d194f8efe1813.tar.bz2 px4-nuttx-5d0227db2d98e2b4ff5d09722c4d194f8efe1813.zip |
SAMA5D4-EK: Updates to get the at25boot configuration building correctly
Diffstat (limited to 'nuttx/configs/sama5d4-ek')
-rw-r--r-- | nuttx/configs/sama5d4-ek/at25boot/defconfig | 2 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/src/Makefile | 4 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/src/at25_main.c | 30 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/src/sam_at25.c | 4 |
4 files changed, 25 insertions, 15 deletions
diff --git a/nuttx/configs/sama5d4-ek/at25boot/defconfig b/nuttx/configs/sama5d4-ek/at25boot/defconfig index 3f7f82de1..169c75a43 100644 --- a/nuttx/configs/sama5d4-ek/at25boot/defconfig +++ b/nuttx/configs/sama5d4-ek/at25boot/defconfig @@ -293,7 +293,7 @@ CONFIG_RAM_START=0x00200000 CONFIG_RAM_VSTART=0x00200000 CONFIG_RAM_SIZE=114688 CONFIG_ARCH_HAVE_SDRAM=y -CONFIG_BOOT_SDRAM_DATA=y +# CONFIG_BOOT_SDRAM_DATA is not set # # Board Selection diff --git a/nuttx/configs/sama5d4-ek/src/Makefile b/nuttx/configs/sama5d4-ek/src/Makefile index d4254223b..7d2521405 100644 --- a/nuttx/configs/sama5d4-ek/src/Makefile +++ b/nuttx/configs/sama5d4-ek/src/Makefile @@ -66,6 +66,10 @@ ifeq ($(CONFIG_SAMA5D4EK_DRAM_MAIN),y) CSRCS += dram_main.c endif +ifeq ($(CONFIG_SAMA5D4EK_AT25_MAIN),y) +CSRCS += at25_main.c +endif + ifeq ($(CONFIG_MTD_AT25),y) ifeq ($(CONFIG_SAMA5_SPI0),y) CSRCS += sam_at25.c diff --git a/nuttx/configs/sama5d4-ek/src/at25_main.c b/nuttx/configs/sama5d4-ek/src/at25_main.c index 30e4eb522..5ec698fc6 100644 --- a/nuttx/configs/sama5d4-ek/src/at25_main.c +++ b/nuttx/configs/sama5d4-ek/src/at25_main.c @@ -40,9 +40,15 @@ #include <nuttx/config.h> #include <stdint.h> +#include <stdlib.h> #include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> #include <debug.h> +#include <nuttx/streams.h> #include <arch/irq.h> #include <apps/hex2bin.h> @@ -57,19 +63,19 @@ # error The AT25 Serial FLASH is not available #endif -#ifndef CONFIG_SAMA5D4EK_NAND_AUTOMOUNT -# error CONFIG_SAMA5D4EK_NAND_AUTOMOUNT must be selected +#ifndef CONFIG_SAMA5D4EK_AT25_AUTOMOUNT +# error CONFIG_SAMA5D4EK_AT25_AUTOMOUNT must be selected #endif #ifndef CONFIG_SAMA5D4EK_AT25_CHARDEV # error CONFIG_SAMA5D4EK_AT25_CHARDEV must be selected #endif -#ifndef CONFIG_BOOT_SDRAM_DATA -# error CONFIG_BOOT_SDRAM_DATA must be selected +#ifdef CONFIG_BOOT_SDRAM_DATA +# error CONFIG_BOOT_SDRAM_DATA must NOT be selected #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 #endif @@ -84,9 +90,8 @@ * Private Data ****************************************************************************/ -static uint8_t g_heximage[CONFIG_SAMA5D4EK_AT25_PROGSIZE]; static uint8_t g_iobuffer[IOBUFFER_SIZE]; -statid uint8_t g_at25dev[DEVNAME_MAXSIZE]; +static char g_at25dev[DEVNAME_MAXSIZE]; /**************************************************************************** * Private Functions @@ -149,11 +154,12 @@ int at25_main(int argc, char *argv) lib_rawinstream(&rawinstream, 0); - /* Wrap the memory buffer as a seek-able OUT stream in which we can buffer - * the binary data. + /* Define a memory buffer of size CONFIG_SAMA5D4EK_AT25_PROGSIZE at the + * 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); /* 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); remaining = memoutstream.public.nput; - dest = g_heximage; + dest = (uint8_t *)CONFIG_SAMA5D4EK_AT25_PROGSIZE; do { @@ -229,7 +235,7 @@ int at25_main(int argc, char *argv) } remaining = memoutstream.public.nput; - src = g_heximage; + src = (const uint8_t *)CONFIG_SAMA5D4EK_AT25_PROGSIZE; do { diff --git a/nuttx/configs/sama5d4-ek/src/sam_at25.c b/nuttx/configs/sama5d4-ek/src/sam_at25.c index 950b64d8e..7ee7f449e 100644 --- a/nuttx/configs/sama5d4-ek/src/sam_at25.c +++ b/nuttx/configs/sama5d4-ek/src/sam_at25.c @@ -77,8 +77,8 @@ int sam_at25_automount(int minor) FAR struct spi_dev_s *spi; FAR struct mtd_dev_s *mtd; #ifdef CONFIG_SAMA5D4EK_AT25_CHARDEV - uint8_t blockdev[18]; - uint8_t chardev[12]; + char blockdev[18]; + char chardev[12]; #endif static bool initialized = false; int ret; |