summaryrefslogtreecommitdiff
path: root/nuttx/configs/open1788
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-12 16:02:48 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-12 16:02:48 +0000
commit774fdc43f3bea13b7852d82536ff96ccbb7ebf03 (patch)
tree670045481e8342d0ac70fce4c27f690133b2a883 /nuttx/configs/open1788
parentd92f89d08d0729d4c7c32fd5d6d2892c4408dcb4 (diff)
downloadpx4-nuttx-774fdc43f3bea13b7852d82536ff96ccbb7ebf03.tar.gz
px4-nuttx-774fdc43f3bea13b7852d82536ff96ccbb7ebf03.tar.bz2
px4-nuttx-774fdc43f3bea13b7852d82536ff96ccbb7ebf03.zip
A few early fixes in kernel build testing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5734 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/open1788')
-rw-r--r--nuttx/configs/open1788/README.txt40
-rwxr-xr-xnuttx/configs/open1788/scripts/kernel-space.ld29
-rw-r--r--nuttx/configs/open1788/scripts/user-space.ld4
-rwxr-xr-xnuttx/configs/open1788/tools/open1788.cfg46
4 files changed, 86 insertions, 33 deletions
diff --git a/nuttx/configs/open1788/README.txt b/nuttx/configs/open1788/README.txt
index da41538cd..cc23ccb77 100644
--- a/nuttx/configs/open1788/README.txt
+++ b/nuttx/configs/open1788/README.txt
@@ -296,16 +296,16 @@ CONFIGURATION
----
This is identical to the nsh configuration below except that NuttX
is built as a kernel-mode, monolithic module and the user applications
- are built separately. This build requires a special make command; not
- just 'make' but make with the following two arguments:
+ are built separately. It is recommends to use a special make command;
+ not just 'make' but make with the following two arguments:
make pass1 pass2
- This is required because in the normal case (just 'make'), make will
- create all dependencies then execute the pass1 and pass2 targets. But
- this example, pass2 depends on auto-generatd files produced during pass1.
- This special make command ('make pass1 pass2') will make the dependencies
- separately for each pass.
+ In the normal case (just 'make'), make will attempt to build both user-
+ and kernel-mode blobs more or less interleaved. This actual works!
+ However, for me it is very confusing so I prefer the above make command:
+ Make the user-space binaries first (pass1), then make the the kernel-space
+ binaries (pass2)
NOTES:
@@ -324,15 +324,23 @@ CONFIGURATION
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
- 3. At the end of the build, there four files will top-level build
- directory:
+ 3. At the end of the build, there will be several files in the top-level
+ NuttX build directory:
- nuttx_user.elf - The pass1 user-space ELF file
- nuttx - The pass2 kernel-space ELF file
- nuttx_user.hex - The pass1 Intel HEX format file
- nuttx.hex - The pass2 Intel HEX file
- System.map - Symbols in the kernel-space ELF file
- User.map - Symbols in the user-space ELF file
+ PASS1:
+ nuttx_user.elf - The pass1 user-space ELF file
+ nuttx_user.hex - The pass1 Intel HEX format file (selected in defconfig)
+ User.map - Symbols in the user-space ELF file
+
+ PASS2:
+ nuttx - The pass2 kernel-space ELF file
+ nuttx.hex - The pass2 Intel HEX file (selected in defconfig)
+ System.map - Symbols in the kernel-space ELF file
+
+ Loading these .elf files with OpenOCD is tricky. It appears to me
+ that when nuttx_user.elf is loaded, it destroys the the nuttx image
+ in FLASH. But loading the nuttx ELF does not harm the nuttx_user.elf
+ in FLASH. Conclusion: Always load nuttx_user.elf before nuttx.
nsh
---
@@ -345,7 +353,7 @@ CONFIGURATION
change this configuration using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
- and misc/tools/
+ and misc/tools//README.txt.
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
diff --git a/nuttx/configs/open1788/scripts/kernel-space.ld b/nuttx/configs/open1788/scripts/kernel-space.ld
index 0d145ffea..84cf9212c 100755
--- a/nuttx/configs/open1788/scripts/kernel-space.ld
+++ b/nuttx/configs/open1788/scripts/kernel-space.ld
@@ -33,33 +33,34 @@
*
****************************************************************************/
-/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
- * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
- * at address 0x2008:000 (used only for heap). When booting from FLASH,
- * FLASH memory is aliased to address 0x0000:0000 where the code expects to
- * begin execution by jumping to the entry point in the 0x0800:0000 address
- * range.
+/* The LPC1788 has 512Kb of FLASH beginning at address 0x0000:0000 and
+ * 96Kb of total SRAM: 64Kb of SRAM in the CPU block beginning at address
+ * 0x10000000 and 32Kb of Peripheral SRAM in two banks, 8Kb at addresses
+ * 0x20000000 bank0 first and 8kb at 0x20002000 at bank0 second. And 16Kb
+ * at 0x20004000 on bank1.
*
* For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of
* FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See
- * also configs/open1788/scripts/kernel.ld).
+ * also configs/open1788/scripts/kernel-space.ld).
*/
MEMORY
{
/* 256Kb FLASH */
- kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K
- uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K
+ kflash (rx) : ORIGIN = 0x00000000, LENGTH = 64K
+ uflash (rx) : ORIGIN = 0x00010000, LENGTH = 448K
- /* 32Kb SRAM */
+ /* 64Kb of SRAM in the CPU block */
- ksram (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
- usram (rwx) : ORIGIN = 0x20001000, LENGTH = 28K
+ ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K
+ usram (rwx) : ORIGIN = 0x10001000, LENGTH = 60K
- /* 16Kb SRAM */
+ /* Other peripheral memory (free, nothing is linked here) */
- sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K
+ ahbram8_b0a(rwx) : ORIGIN = 0x20000000, LENGTH = 8K
+ ahbram8_b0b(rwx) : ORIGIN = 0x20002000, LENGTH = 8K
+ ahbram16(rwx) : ORIGIN = 0x20004000, LENGTH = 16K
}
OUTPUT_ARCH(arm)
diff --git a/nuttx/configs/open1788/scripts/user-space.ld b/nuttx/configs/open1788/scripts/user-space.ld
index 49c0b8728..149be92f1 100644
--- a/nuttx/configs/open1788/scripts/user-space.ld
+++ b/nuttx/configs/open1788/scripts/user-space.ld
@@ -53,8 +53,8 @@ MEMORY
/* 64Kb of SRAM in the CPU block */
- ksram (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
- usram (rwx) : ORIGIN = 0x20001000, LENGTH = 60K
+ ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K
+ usram (rwx) : ORIGIN = 0x10001000, LENGTH = 60K
/* Other peripheral memory (free, nothing is linked here) */
diff --git a/nuttx/configs/open1788/tools/open1788.cfg b/nuttx/configs/open1788/tools/open1788.cfg
index 9c251b4e9..54f699216 100755
--- a/nuttx/configs/open1788/tools/open1788.cfg
+++ b/nuttx/configs/open1788/tools/open1788.cfg
@@ -29,6 +29,7 @@ set CPUROMSIZE 0x80000
set CCLK 12000
### From /usr/local/share/openocd/scripts/targets/lpc17xx.cfg
+### With additions to set the operating frequency to 120MHz
# Common LPC17xx logic
# LPC17xx chips support both JTAG and SWD transports.
@@ -100,6 +101,49 @@ flash bank $_FLASHNAME lpc2000 0x0 $_CPUROMSIZE 0 0 $_TARGETNAME \
adapter_khz 1000
$_TARGETNAME configure -event reset-init {
+ echo "Going to 120MHz"
+
+ # PLL0CON: Disable PLL
+ mww 0x400FC080 0x00000000
+ # PLLFEED
+ mww 0x400FC08C 0x000000AA
+ # PLLFEED
+ mww 0x400FC08C 0x00000055
+
+ # CLKSEL: internal 12MHz RC oscillator Div 1.
+ mww 0x400FC104 0x00000001
+ # CLKSRCSEL: Clock source = internal 12MHz RC oscillator
+ mww 0x400FC10C 0x00000000
+
+ # PLL0CFG: M=10,P=1 -> PLL=240 MHz
+ mww 0x400FC084 0x00000009
+ # PLLFEED
+ mww 0x400FC08C 0x000000AA
+ # PLLFEED
+ mww 0x400FC08C 0x00000055
+
+ # PLL0CON: Enable PLL
+ mww 0x400FC080 0x00000001
+ # PLLFEED
+ mww 0x400FC08C 0x000000AA
+ # PLLFEED
+ mww 0x400FC08C 0x00000055
+
+ sleep 50
+
+ # PLL0CON: Connect PLL
+ # CCLKSEL=PLLED(240MHz)/2 (=120 MHz)
+ mww 0x400FC104 0x00000102
+ # PLLFEED
+ mww 0x400FC08C 0x000000AA
+ # PLLFEED
+ mww 0x400FC08C 0x00000055
+
+ # Dividing CPU clock by 8 should be pretty conservative
+ #
+ #
+ adapter_khz 1500
+
# Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
# "User Flash Mode" where interrupt vectors are _not_ remapped,
# and reside in flash instead).
@@ -114,7 +158,7 @@ $_TARGETNAME configure -event reset-init {
#
# http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1768&type=user
- mww 0x4ba00477 0x01
+ mww 0x400FC040 0x01
}
# if srst is not fitted use VECTRESET to