mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
SAMA5: Add an NSH configuration of the SAMA5D3x-EK board
This commit is contained in:
+16
-2
@@ -1964,8 +1964,22 @@ configs/rgmp
|
||||
information about RGMP.
|
||||
|
||||
configs/sama5d3x-ek
|
||||
The port of NuttX to the Atmel SAMA5D3x-EK development board (where
|
||||
x=1,3,4, or 5).
|
||||
This is the port of NuttX to the Atmel SAMA5D3x-EK development boards
|
||||
(where x=1,3,4, or 5). These boards feature the Atmel SAMA5D3
|
||||
microprocessors. Four different SAMA5D3x-EK kits are available
|
||||
|
||||
- SAMA5D31-EK with the ATSAMA5D1 (http://www.atmel.com/devices/sama5d31.aspx)
|
||||
- SAMA5D33-EK with the ATSAMA5D3 (http://www.atmel.com/devices/sama5d33.aspx)
|
||||
- SAMA5D34-EK with the ATSAMA5D4 (http://www.atmel.com/devices/sama5d34.aspx)
|
||||
- SAMA5D35-EK with the ATSAMA5D5 (http://www.atmel.com/devices/sama5d35.aspx)
|
||||
|
||||
The each consist of an identical base board with different plug-in modules
|
||||
for each CPU. An option 7 inch LCD is also available. All four boards
|
||||
are supported by NuttX with a simple reconfiguration of the processor
|
||||
type.
|
||||
|
||||
There is also the SAMA5D3FAE-EK bundle includes everything: The base
|
||||
board, all four CPU modules, and the LCD.
|
||||
|
||||
configs/sam3u-ek
|
||||
The port of NuttX to the Atmel SAM3U-EK development board.
|
||||
|
||||
+137
-18
@@ -3,7 +3,7 @@ README
|
||||
|
||||
This README file describes the port of NuttX to the SAMA5D3x-EK
|
||||
development boards. These boards feature the Atmel SAMA5D3
|
||||
microprocessors. Three different SAMA5D3x-EK kits are available
|
||||
microprocessors. Four different SAMA5D3x-EK kits are available
|
||||
|
||||
- SAMA5D31-EK with the ATSAMA5D1 (http://www.atmel.com/devices/sama5d31.aspx)
|
||||
- SAMA5D33-EK with the ATSAMA5D3 (http://www.atmel.com/devices/sama5d31.aspx)
|
||||
@@ -73,6 +73,7 @@ Contents
|
||||
- NXFLAT Toolchain
|
||||
- Loading Code into SRAM with J-Link
|
||||
- Writing to FLASH using SAM-BA
|
||||
- Creating and Using NORBOOT
|
||||
- Buttons and LEDs
|
||||
- Serial Consoles
|
||||
- SAMA5D3x-EK Configuration Options
|
||||
@@ -341,6 +342,80 @@ Writing to FLASH using SAM-BA
|
||||
you provide a special code header so that you code can be recognized as a
|
||||
boot-able image by the ROM bootloader.
|
||||
|
||||
Creating and Using NORBOOT
|
||||
==========================
|
||||
|
||||
In order to have more control of debugging code that runs out of NOR FLASH,
|
||||
I created the sama5d3x-ek/norboot configuration. That configuration is
|
||||
described below under "Configurations."
|
||||
|
||||
Here are some general instructions on how to build an use norboot:
|
||||
|
||||
Building:
|
||||
1. Remove any old configurations (if applicable).
|
||||
|
||||
cd <nuttx>
|
||||
make distclean
|
||||
|
||||
2. Install and build the norboot configuration:
|
||||
|
||||
cd tools
|
||||
./configure.sh sama5d3x-ek/<subdir>
|
||||
cd -
|
||||
. ./setenv.sh
|
||||
|
||||
Before sourcing the setenv.sh file above, you should examine it and
|
||||
perform edits as necessary so that TOOLCHAIN_BIN is the correct path
|
||||
to the directory than holds your toolchain binaries.
|
||||
|
||||
3. Rename the binaries. Since you will need two versions of NuttX: this
|
||||
norboot version that runs in internal SRAM and another under test in
|
||||
NOR FLASH, I rename the resulting binary files so that they can be
|
||||
distinguished:
|
||||
|
||||
mv nuttx norboot
|
||||
mv nuttx.hex norboot.hex
|
||||
mv nuttx.bin norboot.bin
|
||||
|
||||
4. Build your NOR configuration and write this into NOR FLASH. Here, for
|
||||
example, is how you would create the NSH NOR configuration:
|
||||
|
||||
cd <nuttx>
|
||||
make distclean # Remove the norboot configuration
|
||||
cd tools
|
||||
./configure.sh sama5d3x-ek/nsh # Establish the NSH configuration
|
||||
cd -
|
||||
make # Build the NSH configuration
|
||||
|
||||
Then use SAM-BA to write the nuttx.bin binary into NOR FLASH. This
|
||||
will involve holding the CS_BOOT button and power cycling to start
|
||||
the ROM loader. The SAM-BA serial connection will be on the device
|
||||
USB port, not the debug USB port. Follow the SAM-BA instruction to
|
||||
write the nuttx.bin binary to NOR FLASH.
|
||||
|
||||
5. Restart the system without holding CS_BOOT to get back to the normal
|
||||
debug setup.
|
||||
|
||||
6. Then start the J-Link GDB server and GDB. In GDB, I do the following:
|
||||
|
||||
(gdb) mon reset # Reset and halt the CPU
|
||||
(gdb) load norboot # Load norboot into internal SRAM
|
||||
(gdb) mon go # Start norboot
|
||||
(gdb) mon halt # Break in
|
||||
(gdb) mon reg pc = 0x10000040 # Set the PC to NOR flash entry point
|
||||
(gdb) mon go # And jump into NOR flash
|
||||
|
||||
The norboot program can also be configured to jump directly into
|
||||
NOR FLASH with out requiring the the final halt and go, but since I
|
||||
have been debugging the early boot sequence, the above sequence has
|
||||
been most convenient for me.
|
||||
|
||||
STATUS:
|
||||
2013-7-30: I have been unable to execute this configuration from NOR
|
||||
FLASH by closing the BMS jumper (J9). As far as I can tell, this
|
||||
jumper does nothing on my board??? So I have been using the norboot
|
||||
configuration exclusively to start the program-under-test in NOR FLASH.
|
||||
|
||||
Buttons and LEDs
|
||||
================
|
||||
|
||||
@@ -608,7 +683,7 @@ Configurations
|
||||
. ./setenv.sh
|
||||
|
||||
Before sourcing the setenv.sh file above, you should examine it and perform
|
||||
edits as necessary so that BUILDROOT_BIN is the correct path to the directory
|
||||
edits as necessary so that TOOLCHAIN_BIN is the correct path to the directory
|
||||
than holds your toolchain binaries.
|
||||
|
||||
And then build NuttX by simply typing the following. At the conclusion of
|
||||
@@ -713,6 +788,58 @@ Configurations
|
||||
1. This program derives from the hello configuration. All of the
|
||||
notes there apply to this configuration as well.
|
||||
|
||||
nsh:
|
||||
This configuration directory provide the NuttShell (NSH).
|
||||
|
||||
NOTES:
|
||||
1. This configuration uses the default USART1 serial console. That
|
||||
is easily changed by reconfiguring to (1) enable a different
|
||||
serial peripheral, and (2) selecting that serial peripheral as
|
||||
the console device.
|
||||
|
||||
2. By default, this configuration is set up to build on Windows
|
||||
under either a Cygwin or MSYS environment using a recent, Windows-
|
||||
native, generic ARM EABI GCC toolchain (such as the CodeSourcery
|
||||
toolchain). Both the build environment and the toolchain
|
||||
selection can easily be changed by reconfiguring:
|
||||
|
||||
CONFIG_HOST_WINDOWS=y : Windows operating system
|
||||
CONFIG_WINDOWS_CYGWIN=y : POSIX environment under windows
|
||||
CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||
|
||||
3. This configuration executes out of CS0 NOR flash and can only
|
||||
be loaded via SAM-BA. These are the relevant configuration options
|
||||
the define the NOR FLASH configuration:
|
||||
|
||||
CONFIG_SAMA5_BOOT_CS0FLASH=y : Boot from FLASH on CS0
|
||||
CONFIG_BOOT_RUNFROMFLASH=y : Run in place on FLASH (vs copying to RAM)
|
||||
|
||||
CONFIG_SAMA5_EBICS0=y : Enable CS0 external memory
|
||||
CONFIG_SAMA5_EBICS0_SIZE=134217728 : Memory size is 128KB
|
||||
CONFIG_SAMA5_EBICS0_NOR=y : Memory type is NOR FLASH
|
||||
|
||||
CONFIG_FLASH_START=0x10000000 : Physical FLASH start address
|
||||
CONFIG_FLASH_VSTART=0x10000000 : Virtual FLASH start address
|
||||
CONFIG_FLASH_SIZE=134217728 : FLASH size (again)
|
||||
|
||||
CONFIG_RAM_START=0x00300400 : Data stored after page table
|
||||
CONFIG_RAM_VSTART=0x00300400
|
||||
CONFIG_RAM_SIZE=114688 : Available size of 128KB - 16KB for page table
|
||||
|
||||
NOTE: In order to boot in this configuration, you need to close the
|
||||
BMS jumper.
|
||||
|
||||
4. This configuration has support for NSH built-in applications enabled.
|
||||
However, no built-in applications are selected in the base configuration.
|
||||
|
||||
STATUS:
|
||||
2013-7-31: I have been unable to execute this configuration from NOR
|
||||
FLASH by closing the BMS jumper (J9). As far as I can tell, this
|
||||
jumper does nothing on my board??? I have been using the norboot
|
||||
configuration to start the program in NOR FLASH (see just above).
|
||||
See "Creating and Using NORBOOT" above.
|
||||
2013-7-31: This NSH configuration appears to be fully functional.
|
||||
|
||||
ostest:
|
||||
This configuration directory, performs a simple OS test using
|
||||
examples/ostest.
|
||||
@@ -734,7 +861,8 @@ Configurations
|
||||
CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||
|
||||
3. This configuration executes out of CS0 NOR flash and can only
|
||||
be loaded via JTAG. 128MB
|
||||
be loaded via SAM-BA. These are the relevant configuration options
|
||||
the define the NOR FLASH configuration:
|
||||
|
||||
CONFIG_SAMA5_BOOT_CS0FLASH=y : Boot from FLASH on CS0
|
||||
CONFIG_BOOT_RUNFROMFLASH=y : Run in place on FLASH (vs copying to RAM)
|
||||
@@ -759,20 +887,11 @@ Configurations
|
||||
FLASH by closing the BMS jumper (J9). As far as I can tell, this
|
||||
jumper does nothing on my board??? I have been using the norboot
|
||||
configuration to start the program in NOR FLASH (see just above).
|
||||
I do that as follows:
|
||||
|
||||
1. I build the norboot configuration and rename nuttx to norboot
|
||||
2. I build the the ostest configuration and write it to NOR FLASH
|
||||
using SAM-BA
|
||||
3. Then I start the J-Link GDB server and GDB. In GDB, I do the
|
||||
following:
|
||||
|
||||
(gdb) mon reset # Reset and halt the CPU
|
||||
(gdb) load norboot # Load norboot into internal SRAM
|
||||
(gdb) mon go # Start norboot
|
||||
(gdb) mon halt # Break in
|
||||
(gdb) mon reg pc = 0x10000040 # Set the PC to NOR flash entry point
|
||||
(gdb) mon go # And jump into NOR flash
|
||||
See "Creating and Using NORBOOT" above.
|
||||
|
||||
2013-7-31:
|
||||
The OS test configuration is functional.
|
||||
The OS test configuration is basically functional, but takes a very
|
||||
long time in the round-robin scheduler test computing prime numbers.
|
||||
This test is suppose to be slow -- like several seconds -- but not
|
||||
many minutes. No idea why yet. The best guess would be an excessive
|
||||
number of context switches.
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
############################################################################
|
||||
# configs/sama5d3x-ek/nsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)armv7-a$(DELIM)Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_BOOT_ISRAM),y)
|
||||
LDSCRIPT = isram.ld
|
||||
endif
|
||||
ifeq ($(CONFIG_SAMA5_BOOT_SDRAM),y)
|
||||
LDSCRIPT = ddram.ld
|
||||
endif
|
||||
ifeq ($(CONFIG_SAMA5_BOOT_CS0FLASH),y)
|
||||
LDSCRIPT = norflash.ld
|
||||
endif
|
||||
ifeq ($(CONFIG_SAMA5_BOOT_CS1FLASH),y)
|
||||
# LDSCRIPT = cs1flash.ld
|
||||
endif
|
||||
ifeq ($(CONFIG_SAMA5_BOOT_CS2FLASH),y)
|
||||
# LDSCRIPT = cs2flash.ld
|
||||
endif
|
||||
ifeq ($(CONFIG_SAMA5_BOOT_CS3FLASH),y)
|
||||
# LDSCRIPT = cs3flash.ld
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
|
||||
MAXOPTIMIZATION = -O2
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(ARCROSSDEV)ar rcs
|
||||
NM = $(ARCROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
else
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS = -mcpu=cortex-a5 -mfpu=vfpv4-d16
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
ifeq ($(CONFIG_HOST_WINDOWS),y)
|
||||
HOSTEXEEXT = .exe
|
||||
else
|
||||
HOSTEXEEXT =
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native host tools
|
||||
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
|
||||
MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
|
||||
else
|
||||
# Linux/Cygwin-native host tools
|
||||
MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mkdeps$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
# configs/samard3x-ek/nsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This is the Cygwin path to the location where I installed the Atmel GCC
|
||||
# toolchain under Windows. You will also have to edit this if you install
|
||||
# this toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
|
||||
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||
# at those locations as well.
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
@@ -0,0 +1,153 @@
|
||||
/************************************************************************************
|
||||
* configs/sama5dx-ek/src/sam_cxxinitialize.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <arch/sama5/chip.h>
|
||||
#include "chip.h"
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
/* Debug ****************************************************************************/
|
||||
/* Non-standard debug that may be enabled just for testing the static constructors */
|
||||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_CXX
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CXX
|
||||
# define cxxdbg dbg
|
||||
# define cxxlldbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define cxxvdbg vdbg
|
||||
# define cxxllvdbg llvdbg
|
||||
# else
|
||||
# define cxxvdbg(x...)
|
||||
# define cxxllvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define cxxdbg(x...)
|
||||
# define cxxlldbg(x...)
|
||||
# define cxxvdbg(x...)
|
||||
# define cxxllvdbg(x...)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Types
|
||||
************************************************************************************/
|
||||
/* This type defines one entry in initialization array */
|
||||
|
||||
typedef void (*initializer_t)(void);
|
||||
|
||||
/************************************************************************************
|
||||
* External references
|
||||
************************************************************************************/
|
||||
/* _sinit and _einit are symbols exported by the linker script that mark the
|
||||
* beginning and the end of the C++ initialization section.
|
||||
*/
|
||||
|
||||
extern initializer_t _sinit;
|
||||
extern initializer_t _einit;
|
||||
|
||||
/* _stext and _etext are symbols exported by the linker script that mark the
|
||||
* beginning and the end of text.
|
||||
*/
|
||||
|
||||
extern uint32_t _stext;
|
||||
extern uint32_t _etext;
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_cxxinitialize
|
||||
*
|
||||
* Description:
|
||||
* If C++ and C++ static constructors are supported, then this function
|
||||
* must be provided by board-specific logic in order to perform
|
||||
* initialization of the static C++ class instances.
|
||||
*
|
||||
* This function should then be called in the application-specific
|
||||
* user_start logic in order to perform the C++ initialization. NOTE
|
||||
* that no component of the core NuttX RTOS logic is involved; This
|
||||
* function defintion only provides the 'contract' between application
|
||||
* specific C++ code and platform-specific toolchain support
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_cxxinitialize(void)
|
||||
{
|
||||
initializer_t *initp;
|
||||
|
||||
cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
|
||||
&_sinit, &_einit, &_stext, &_etext);
|
||||
|
||||
/* Visit each entry in the initialzation table */
|
||||
|
||||
for (initp = &_sinit; initp != &_einit; initp++)
|
||||
{
|
||||
initializer_t initializer = *initp;
|
||||
cxxdbg("initp: %p initializer: %p\n", initp, initializer);
|
||||
|
||||
/* Make sure that the address is non-NULL and lies in the text region
|
||||
* defined by the linker script. Some toolchains may put NULL values
|
||||
* or counts in the initialization table
|
||||
*/
|
||||
|
||||
if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
|
||||
{
|
||||
cxxdbg("Calling %p\n", initializer);
|
||||
initializer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
|
||||
Reference in New Issue
Block a user