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
This commit is contained in:
parent
23c8c591e9
commit
73ef58fda6
@ -117,7 +117,7 @@ uint8_t mpu_log2regionsize(size_t size)
|
|||||||
|
|
||||||
/* The minimum permitted region size is 16 bytes (log2(16) = 4. */
|
/* 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;
|
return l2size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,16 +296,16 @@ CONFIGURATION
|
|||||||
----
|
----
|
||||||
This is identical to the nsh configuration below except that NuttX
|
This is identical to the nsh configuration below except that NuttX
|
||||||
is built as a kernel-mode, monolithic module and the user applications
|
is built as a kernel-mode, monolithic module and the user applications
|
||||||
are built separately. This build requires a special make command; not
|
are built separately. It is recommends to use a special make command;
|
||||||
just 'make' but make with the following two arguments:
|
not just 'make' but make with the following two arguments:
|
||||||
|
|
||||||
make pass1 pass2
|
make pass1 pass2
|
||||||
|
|
||||||
This is required because in the normal case (just 'make'), make will
|
In the normal case (just 'make'), make will attempt to build both user-
|
||||||
create all dependencies then execute the pass1 and pass2 targets. But
|
and kernel-mode blobs more or less interleaved. This actual works!
|
||||||
this example, pass2 depends on auto-generatd files produced during pass1.
|
However, for me it is very confusing so I prefer the above make command:
|
||||||
This special make command ('make pass1 pass2') will make the dependencies
|
Make the user-space binaries first (pass1), then make the the kernel-space
|
||||||
separately for each pass.
|
binaries (pass2)
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
|
||||||
@ -324,15 +324,23 @@ CONFIGURATION
|
|||||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
||||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
||||||
|
|
||||||
3. At the end of the build, there four files will top-level build
|
3. At the end of the build, there will be several files in the top-level
|
||||||
directory:
|
NuttX build directory:
|
||||||
|
|
||||||
nuttx_user.elf - The pass1 user-space ELF file
|
PASS1:
|
||||||
nuttx - The pass2 kernel-space ELF file
|
nuttx_user.elf - The pass1 user-space ELF file
|
||||||
nuttx_user.hex - The pass1 Intel HEX format file
|
nuttx_user.hex - The pass1 Intel HEX format file (selected in defconfig)
|
||||||
nuttx.hex - The pass2 Intel HEX file
|
User.map - Symbols in the user-space ELF file
|
||||||
System.map - Symbols in the kernel-space ELF file
|
|
||||||
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
|
nsh
|
||||||
---
|
---
|
||||||
@ -345,7 +353,7 @@ CONFIGURATION
|
|||||||
change this configuration using that tool, you should:
|
change this configuration using that tool, you should:
|
||||||
|
|
||||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
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
|
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||||
reconfiguration process.
|
reconfiguration process.
|
||||||
|
@ -33,33 +33,34 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000,
|
/* The LPC1788 has 512Kb of FLASH beginning at address 0x0000:0000 and
|
||||||
* 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning
|
* 96Kb of total SRAM: 64Kb of SRAM in the CPU block beginning at address
|
||||||
* at address 0x2008:000 (used only for heap). When booting from FLASH,
|
* 0x10000000 and 32Kb of Peripheral SRAM in two banks, 8Kb at addresses
|
||||||
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
* 0x20000000 bank0 first and 8kb at 0x20002000 at bank0 second. And 16Kb
|
||||||
* begin execution by jumping to the entry point in the 0x0800:0000 address
|
* at 0x20004000 on bank1.
|
||||||
* range.
|
|
||||||
*
|
*
|
||||||
* For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of
|
* 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
|
* 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
|
MEMORY
|
||||||
{
|
{
|
||||||
/* 256Kb FLASH */
|
/* 256Kb FLASH */
|
||||||
|
|
||||||
kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K
|
kflash (rx) : ORIGIN = 0x00000000, LENGTH = 64K
|
||||||
uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K
|
uflash (rx) : ORIGIN = 0x00010000, LENGTH = 448K
|
||||||
|
|
||||||
/* 32Kb SRAM */
|
/* 64Kb of SRAM in the CPU block */
|
||||||
|
|
||||||
ksram (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
|
ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K
|
||||||
usram (rwx) : ORIGIN = 0x20001000, LENGTH = 28K
|
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)
|
OUTPUT_ARCH(arm)
|
||||||
|
@ -53,8 +53,8 @@ MEMORY
|
|||||||
|
|
||||||
/* 64Kb of SRAM in the CPU block */
|
/* 64Kb of SRAM in the CPU block */
|
||||||
|
|
||||||
ksram (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
|
ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K
|
||||||
usram (rwx) : ORIGIN = 0x20001000, LENGTH = 60K
|
usram (rwx) : ORIGIN = 0x10001000, LENGTH = 60K
|
||||||
|
|
||||||
/* Other peripheral memory (free, nothing is linked here) */
|
/* Other peripheral memory (free, nothing is linked here) */
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ set CPUROMSIZE 0x80000
|
|||||||
set CCLK 12000
|
set CCLK 12000
|
||||||
|
|
||||||
### From /usr/local/share/openocd/scripts/targets/lpc17xx.cfg
|
### From /usr/local/share/openocd/scripts/targets/lpc17xx.cfg
|
||||||
|
### With additions to set the operating frequency to 120MHz
|
||||||
# Common LPC17xx logic
|
# Common LPC17xx logic
|
||||||
|
|
||||||
# LPC17xx chips support both JTAG and SWD transports.
|
# LPC17xx chips support both JTAG and SWD transports.
|
||||||
@ -100,6 +101,49 @@ flash bank $_FLASHNAME lpc2000 0x0 $_CPUROMSIZE 0 0 $_TARGETNAME \
|
|||||||
adapter_khz 1000
|
adapter_khz 1000
|
||||||
|
|
||||||
$_TARGETNAME configure -event reset-init {
|
$_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
|
# Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
|
||||||
# "User Flash Mode" where interrupt vectors are _not_ remapped,
|
# "User Flash Mode" where interrupt vectors are _not_ remapped,
|
||||||
# and reside in flash instead).
|
# 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
|
# 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
|
# if srst is not fitted use VECTRESET to
|
||||||
|
@ -378,26 +378,48 @@ must be is one of the following:
|
|||||||
knsh:
|
knsh:
|
||||||
This is identical to the nsh configuration below except that NuttX
|
This is identical to the nsh configuration below except that NuttX
|
||||||
is built as a kernel-mode, monolithic module and the user applications
|
is built as a kernel-mode, monolithic module and the user applications
|
||||||
are built separately. This build requires a special make command; not
|
are built separately. It is recommends to use a special make command;
|
||||||
just 'make' but make with the following two arguments:
|
not just 'make' but make with the following two arguments:
|
||||||
|
|
||||||
make pass1 pass2
|
make pass1 pass2
|
||||||
|
|
||||||
This is required because in the normal case (just 'make'), make will
|
In the normal case (just 'make'), make will attempt to build both user-
|
||||||
create all dependencies then execute the pass1 and pass2 targets. But
|
and kernel-mode blobs more or less interleaved. This actual works!
|
||||||
this example, pass2 depends on auto-generatd files produced during pass1.
|
However, for me it is very confusing so I prefer the above make command:
|
||||||
This special make command ('make pass1 pass2') will make the dependencies
|
Make the user-space binaries first (pass1), then make the the kernel-space
|
||||||
separately for each pass.
|
binaries (pass2)
|
||||||
|
|
||||||
At the end of the build, there four files will top-level build
|
NOTES:
|
||||||
directory:
|
|
||||||
|
|
||||||
nuttx_user.elf - The pass1 ELF file
|
1. This configuration uses the mconf-based configuration tool. To
|
||||||
nuttx - The pass2 ELF file
|
change this configuration using that tool, you should:
|
||||||
nuttx_user.hex - The pass1 Intel HEX format file
|
|
||||||
nuttx.hex - The pass2 Intel HEX file
|
|
||||||
|
|
||||||
The J-Link program will except files in .hex, .mot, .srec, and .bin
|
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
|
||||||
|
|
||||||
|
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 programmer will except files in .hex, .mot, .srec, and .bin
|
||||||
formats.
|
formats.
|
||||||
|
|
||||||
nsh:
|
nsh:
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <nuttx/mm.h>
|
#include <nuttx/mm.h>
|
||||||
|
@ -182,7 +182,7 @@ static inline void group_release(FAR struct task_group_s *group)
|
|||||||
/* Free resource held by the stream list */
|
/* Free resource held by the stream list */
|
||||||
|
|
||||||
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
|
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||||
lib_releaselist(&group->tg_streamlist);
|
lib_releaselist(group->tg_streamlist);
|
||||||
#else
|
#else
|
||||||
lib_releaselist(&group->tg_streamlist);
|
lib_releaselist(&group->tg_streamlist);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user