summaryrefslogtreecommitdiff
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
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
-rw-r--r--nuttx/arch/arm/src/armv7-m/up_mpu.c2
-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
-rw-r--r--nuttx/configs/sam3u-ek/README.txt50
-rw-r--r--nuttx/include/nuttx/kmalloc.h1
-rw-r--r--nuttx/sched/group_leave.c2
8 files changed, 125 insertions, 49 deletions
diff --git a/nuttx/arch/arm/src/armv7-m/up_mpu.c b/nuttx/arch/arm/src/armv7-m/up_mpu.c
index 2b8a8f994..88d69e8b0 100644
--- a/nuttx/arch/arm/src/armv7-m/up_mpu.c
+++ b/nuttx/arch/arm/src/armv7-m/up_mpu.c
@@ -117,7 +117,7 @@ uint8_t mpu_log2regionsize(size_t size)
/* The minimum permitted region size is 16 bytes (log2(16) = 4. */
- for (l2size = 4; l2size < 32 && size > (1 << l2size); size++);
+ for (l2size = 4; l2size < 32 && size > (1 << l2size); l2size++);
return l2size;
}
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
diff --git a/nuttx/configs/sam3u-ek/README.txt b/nuttx/configs/sam3u-ek/README.txt
index c5daedbe7..e94a9a319 100644
--- a/nuttx/configs/sam3u-ek/README.txt
+++ b/nuttx/configs/sam3u-ek/README.txt
@@ -378,26 +378,48 @@ must be is one of the following:
knsh:
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)
- At the end of the build, there four files will top-level build
- directory:
+ NOTES:
+
+ 1. This configuration uses the mconf-based configuration tool. To
+ change this configuration using that tool, you should:
+
+ a. Build and install the kconfig-mconf tool. See nuttx/README.txt
+ and misc/tools/README.txt.
+
+ b. Execute 'make menuconfig' in nuttx/ in order to start the
+ reconfiguration process.
+
+ 2. Uses the older, OABI, buildroot toolchain. But that is easily
+ reconfigured:
+
+ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
+ CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
+
+ 3. At the end of the build, there will be several files in the top-level
+ NuttX build directory:
+
+ 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
- nuttx_user.elf - The pass1 ELF file
- nuttx - The pass2 ELF file
- nuttx_user.hex - The pass1 Intel HEX format file
- nuttx.hex - The pass2 Intel HEX 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
- The J-Link program will except files in .hex, .mot, .srec, and .bin
+ The J-Link programmer will except files in .hex, .mot, .srec, and .bin
formats.
nsh:
diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h
index d712bddf4..69ceb06bf 100644
--- a/nuttx/include/nuttx/kmalloc.h
+++ b/nuttx/include/nuttx/kmalloc.h
@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <nuttx/mm.h>
diff --git a/nuttx/sched/group_leave.c b/nuttx/sched/group_leave.c
index 5f3c684ca..ceac10c38 100644
--- a/nuttx/sched/group_leave.c
+++ b/nuttx/sched/group_leave.c
@@ -182,7 +182,7 @@ static inline void group_release(FAR struct task_group_s *group)
/* Free resource held by the stream list */
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
- lib_releaselist(&group->tg_streamlist);
+ lib_releaselist(group->tg_streamlist);
#else
lib_releaselist(&group->tg_streamlist);
#endif