Add pcDuino patch needed for booting. Update README to explain why

This commit is contained in:
Gregory Nutt 2013-12-08 10:56:37 -06:00
parent bbf42e7360
commit a36da96c3c
3 changed files with 200 additions and 7 deletions

View File

@ -103,6 +103,7 @@ Contents
- Buttons
- JTAG
- Booting NuttX from an SD card
- Configurations
pcDuino v1 Connectors
=====================
@ -316,3 +317,95 @@ Booting NuttX from an SD card
microSD slot. Reset the pcDuino and NuttX should be running.
Reference: https://www.olimex.com/wiki/Bare_Metal_programming_A13#Stand_alone_program_running_with_uboot
Configurations
==============
Information Common to All Configurations
----------------------------------------
Each pcDuino configuration is maintained in a sub-directory and
can be selected as follow:
cd tools
./configure.sh pcduino-a10/<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.
And then build NuttX by simply typing the following. At the conclusion of
the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
make
The <subdir> that is provided above as an argument to the tools/configure.sh
must be is one of the following.
NOTES:
1. These configurations use the mconf-based configuration tool. To
change any of these configurations using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
and misc/tools/
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
2. Unless stated otherwise, all configurations generate console
output on UART0.
3. All of these configurations use the Code Sourcery for Windows toolchain
(unless stated otherwise in the description of the configuration). That
toolchain selection can easily be reconfigured using 'make menuconfig'.
Here are the relevant current settings:
Build Setup:
CONFIG_HOST_WINDOS=y : Microsoft Windows
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin or other POSIX environment
System Type -> Toolchain:
CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
The setenv.sh file is available for you to use to set the PATH
variable. The path in the that file may not, however, be correct
for your installation. Try 'which arm-none-eabi-gcc' to make sure that
you are selecting the right tool.
Configuration Sub-directories
-----------------------------
nsh:
This configuration directory provide the NuttShell (NSH). There are
STATUS:
This configuration builds and runs, but only if the patch at
nuttx/configs/pcduino-a10/nsh/pcduino-140107.patch is applied. This patchfile
contains some fixes that are as-of-yet not well understood and so cannot be checked
in. Below is a summary of the kludges currently in this patch file:
a) nuttx/arch/arm/src/armv7-a/arm_head.S: Initializes the MMU so that A10
peripherals can be accessed very early. This is not normally necessary, but
is required because of certain debug statements that seem to be necessary
in a1x_boot.c (see the next item).
b) nuttx/arch/arm/src/a1x/a1x_boot.c: This file contains several arbitrary
statements that just output debug information. Some of these can be removed,
but if you remove all of the debug output, the pcDuino will not boot. No
idea yet why.
c) nuttx/arch/arm/src/armv7-a/arm_mmu.c: After setting a page table entry
for the MMU, the MMU's TLBs are flushed for that memory region. That
flushing must currently be commented out. Why? I am not sure, but I
think that this is because TLBs are being flushed why they are in use. For
the pcDuino, we are executing out of SDRAM so when the TLBs for the SDRAM
region are invalidated that cause a crash. That has not been proven,
however.
d) nuttx/arch/arm/src/common/up_internal.h: One of the values need for UART
baud calculation is missing (the frequency of SCLK, the UART input clock).
As a result, UART configuration is currently suppressed by a setting in
this file.

View File

@ -0,0 +1,106 @@
diff --git a/nuttx/arch/arm/src/a1x/a1x_boot.c b/nuttx/arch/arm/src/a1x/a1x_boot.c
index 3cc6323..ad42790 100644
--- a/nuttx/arch/arm/src/a1x/a1x_boot.c
+++ b/nuttx/arch/arm/src/a1x/a1x_boot.c
@@ -312,12 +312,14 @@ void up_boot(void)
* for all IO regions (Including the vector region).
*/
+lowsyslog("Calling a1x_setupmappings\n"); // REMOVE ME
a1x_setupmappings();
/* Provide a special mapping for the IRAM interrupt vector positioned in
* high memory.
*/
+lowsyslog("Calling a1x_vectormapping\n"); // REMOVE ME
a1x_vectormapping();
#endif /* CONFIG_ARCH_ROMPGTABLE */
@@ -326,16 +328,19 @@ void up_boot(void)
* arm_vector.S
*/
+lowsyslog("Calling a1x_copyvectorblock\n"); // REMOVE ME
a1x_copyvectorblock();
/* Initialize the FPU */
#ifdef CONFIG_ARCH_FPU
+lowsyslog("Calling arm_fpuconfig\n"); // REMOVE ME
arm_fpuconfig();
#endif
/* Perform common, low-level chip initialization (might do nothing) */
+lowsyslog("Calling a1x_lowsetup\n"); // REMOVE ME
a1x_lowsetup();
/* Perform early serial initialization if we are going to use the serial
@@ -343,6 +348,7 @@ void up_boot(void)
*/
#ifdef USE_EARLYSERIALINIT
+lowsyslog("Calling up_earlyserialinit\n"); // REMOVE ME
up_earlyserialinit();
#endif
@@ -353,6 +359,7 @@ void up_boot(void)
*/
#ifdef CONFIG_NUTTX_KERNEL
+lowsyslog("Calling a1x_userspace\n"); // REMOVE ME
a1x_userspace();
#endif
@@ -362,5 +369,7 @@ void up_boot(void)
* - Configuration of board specific resources (PIOs, LEDs, etc).
*/
+lowsyslog("Calling a1x_boardinitialize\n"); // REMOVE ME
a1x_boardinitialize();
+lowsyslog("Returning\n"); // REMOVE ME
}
diff --git a/nuttx/arch/arm/src/armv7-a/arm_head.S b/nuttx/arch/arm/src/armv7-a/arm_head.S
index bce82d5..924bd24 100644
--- a/nuttx/arch/arm/src/armv7-a/arm_head.S
+++ b/nuttx/arch/arm/src/armv7-a/arm_head.S
@@ -220,6 +220,12 @@ __start:
teq r0, r2
bne .Lpgtableclear
+ movw r1, #0x0416 // REMOVE ME
+ movt r1, #0x01c0
+ movw r2, #0x4070
+ movt r2, #0x0000
+ str r1, [r2]
+
#ifdef ARMV7A_PGTABLE_MAPPING
/* If the page table does not lie in the same address space as does the
* mapped RAM in either case. So we will need to create a special
diff --git a/nuttx/arch/arm/src/armv7-a/arm_mmu.c b/nuttx/arch/arm/src/armv7-a/arm_mmu.c
index f82490c..5c16e48 100644
--- a/nuttx/arch/arm/src/armv7-a/arm_mmu.c
+++ b/nuttx/arch/arm/src/armv7-a/arm_mmu.c
@@ -94,7 +94,7 @@ void mmu_l1_setentry(uint32_t paddr, uint32_t vaddr, uint32_t mmuflags)
/* Invalidate the TLB cache associated with virtual address range */
- mmu_invalidate_region(vaddr, 1024*1024);
+// mmu_invalidate_region(vaddr, 1024*1024);
}
#endif
diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h
index eb3ca89..8310d8a 100644
--- a/nuttx/arch/arm/src/common/up_internal.h
+++ b/nuttx/arch/arm/src/common/up_internal.h
@@ -60,7 +60,7 @@
#undef CONFIG_SUPPRESS_INTERRUPTS /* DEFINED: Do not enable interrupts */
#undef CONFIG_SUPPRESS_TIMER_INTS /* DEFINED: No timer */
#undef CONFIG_SUPPRESS_SERIAL_INTS /* DEFINED: Console will poll */
-#undef CONFIG_SUPPRESS_UART_CONFIG /* DEFINED: Do not reconfig UART */
+#define CONFIG_SUPPRESS_UART_CONFIG 1 /* DEFINED: Do not reconfig UART */
#undef CONFIG_DUMP_ON_EXIT /* DEFINED: Dump task state on exit */
/* Determine which (if any) console driver to use. If a console is enabled

View File

@ -2577,13 +2577,7 @@ Configurations
2. Unless stated otherwise, all configurations generate console
output on UART0 (J3).
3. Unless otherwise stated, the configurations are setup for
Linux (or any other POSIX environment like Cygwin under Windows):
Build Setup:
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
4. All of these configurations use the Code Sourcery for Windows toolchain
3. All of these configurations use the Code Sourcery for Windows toolchain
(unless stated otherwise in the description of the configuration). That
toolchain selection can easily be reconfigured using 'make menuconfig'.
Here are the relevant current settings: