This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
[PATCH] for ROMRAM support for PID board
- To: ecos-discuss at sources dot redhat dot com
- Subject: [ECOS] [PATCH] for ROMRAM support for PID board
- From: "David Airlie" <David dot Airlie at parthus dot com>
- Date: 15 Feb 2001 21:24:08 +0000
Hi,
Please find attached two files one containing a tgz file with the
three mlt files (new files) and a patch against CVS for the ROM/RAM pid
support
I've fixed most of things requested by Jonathan, the only one remaining is
the 0x8000 define that I've called CYGHWR_HAL_RAM_VADDR, I cannot think
how to get this, for the UNMAPPED macro, it needs to come from a .h as
0x8000, I cannot use __exception_handlers and it seems to generate a
reset_vector address that is total crap, (it seems to use the variable
storing execption_handlers rather than the contents...
Maybe I'm still missing something but I think I messed around with this a
fair bit..
Also to use the ROMRAM image with the flash programmer for the PID board
the arm-elf-objcopy command is different than when doing a ROM image
arm-elf-objcopy --strip-debug --change-address=0x58000 <romram.in>
<flash.out>
The change addresses value is different.. this may require a note in the
PID docs..
Dave.
--
David Airlie, Software Engineer, Parthus Technologies plc.,
Mary Rosse Centre, National Tech Park, Limerick, Ireland.
t: +353-61-508116 / f: +353-61-508101 / David.Airlie@parthus.com
? hal/arm/pid/current/include/pkgconf/mlt_arm_pid_romram.h
? hal/arm/pid/current/include/pkgconf/mlt_arm_pid_romram.ldi
? hal/arm/pid/current/include/pkgconf/mlt_arm_pid_romram.mlt
? hal/arm/pid/current/src/jtag_diag.s
? hal/arm/pid/current/src/jtag_diag.c
? hal/arm/pid/current/src/hal_diag.c_jtag
Index: hal/arm/arch/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/ChangeLog,v
retrieving revision 1.49
diff -u -r1.49 ChangeLog
--- ChangeLog 2001/02/15 18:18:14 1.49
+++ ChangeLog 2001/02/15 20:00:17
@@ -1,3 +1,11 @@
+2001-02-15 Dave Airlie <airlied@parthus.com>
+ * src/vectors.S (UNMAPPED()): added a case for the ROMRAM startup
+ where we want to boot code from ROM and have it jump to RAM.
+ Currently only implemented on PID board.
+ Also added CYGHWR_HAL_RAM_VADDR, for when the code is compiled
+ for ROMRAM, it doesn't get compiled for RAM at 0, but an offset
+ value.
+
2001-02-13 Gary Thomas <gthomas@redhat.com>
* src/vectors.S (handle_IRQ_or_FIQ): Change behaviour for
Index: hal/arm/arch/current/src/vectors.S
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/arch/current/src/vectors.S,v
retrieving revision 1.36
diff -u -r1.36 vectors.S
--- vectors.S 2001/02/15 18:18:14 1.36
+++ vectors.S 2001/02/15 20:00:18
@@ -52,6 +52,7 @@
# undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
# undef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
#endif
+#include CYGHWR_MEMORY_LAYOUT_H
#include <cyg/hal/hal_platform_setup.h>
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
@@ -119,15 +120,28 @@
//
// But usually it's not defined, so the behaviour is the obvious.
+// CYGHWR_HAL_RAM_VADDR is used when compiling for a ROM RAM startup
+// Where the image is generated for RAM starting a CYG_HAL_RAM_VADDR
+// but the reset vector needs to be in ROM, so the code can be found
+// at initialisation. this can be defined in hal_platform_setup.h
+// e.g. on a PID board, code is generated for 0x8000, but is in ROM
+// at 0x4000000, in this case the reset vector is at 0x8044 - 0 + 0x4000000
+// - 8000 which gives a reset vector of 0x4000044 which is correct.
+
#ifdef CYGHWR_HAL_ARM_HAS_MMU
# ifndef CYGHWR_HAL_ROM_VADDR
# define CYGHWR_HAL_ROM_VADDR __exception_handlers
# endif
# define UNMAPPED(x) ((x)-CYGHWR_HAL_ROM_VADDR)
+#elif defined(CYG_HAL_STARTUP_ROMRAM)
+# ifndef CYGHWR_HAL_RAM_VADDR
+# define CYGHWR_HAL_RAM_VADDR 0
+# endif
+# define UNMAPPED(x) ((x)-CYGMEM_REGION_ram+CYGMEM_REGION_rom-CYGHWR_HAL_RAM_VADDR)
#else
# define UNMAPPED(x) (x)
#endif
-
+
#define UNMAPPED_PTR(name) \
.##name: .word UNMAPPED(name)
@@ -315,7 +329,7 @@
LED 4
-#if defined(CYG_HAL_STARTUP_ROM)
+#if defined(CYG_HAL_STARTUP_ROM)||defined(CYG_HAL_STARTUP_ROMRAM)
// Set up reset vector
mov r0,#0
ldr r1,.__exception_handlers
@@ -323,6 +337,7 @@
str r2,[r0,#0x00]
ldr r2,=warm_reset
str r2,[r0,#0x20]
+#if defined(CYG_HAL_STARTUP_ROM)
// Relocate [copy] data from ROM to RAM
ldr r3,.__rom_data_start
ldr r4,.__ram_data_start
@@ -336,6 +351,7 @@
cmp r4,r5
bne 1b
2:
+#endif
#endif
// initialize interrupt/exception environments
Index: hal/arm/pid/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/pid/current/ChangeLog,v
retrieving revision 1.24
diff -u -r1.24 ChangeLog
--- ChangeLog 2001/02/15 18:18:15 1.24
+++ ChangeLog 2001/02/15 20:00:18
@@ -1,3 +1,16 @@
+2001-02-15 David Airlie <airlied@parthus.com>
+ * cdl/hal_arm_pid.cdl: Added ROMRAM option for CYG_HAL_STARTUP
+
+ * include/hal_platform_setup.h: Added define for RAM_VADDR
+ and macro to RELOCATE_TEXT_SEGMENT for ROMRAM startup
+
+ * src/hal_diag.c: changes for ROMRAM startup
+
+ * include/pkgconf/mlt_arm_pid_romram.mlt
+ include/pkgconf/mlt_arm_pid_romram.ldi
+ include/pkgconf/mlt_arm_pid_romram.h: files added for ROMRAM startup
+
+
2001-02-13 Gary Thomas <gthomas@redhat.com>
* src/pid_misc.c (hal_IRQ_handler):
Index: hal/arm/pid/current/cdl/hal_arm_pid.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/pid/current/cdl/hal_arm_pid.cdl,v
retrieving revision 1.6
diff -u -r1.6 hal_arm_pid.cdl
--- hal_arm_pid.cdl 2001/02/13 01:23:23 1.6
+++ hal_arm_pid.cdl 2001/02/15 20:00:18
@@ -70,7 +70,7 @@
cdl_component CYG_HAL_STARTUP {
display "Startup type"
flavor data
- legal_values {"RAM" "ROM"}
+ legal_values {"RAM" "ROM" "ROMRAM" }
default_value {"RAM"}
no_define
define -file system.h CYG_HAL_STARTUP
@@ -303,7 +303,8 @@
flavor data
no_define
calculated { CYG_HAL_STARTUP == "RAM" ? "arm_pid_ram" : \
- "arm_pid_rom" }
+ CYG_HAL_STARTUP == "ROM" ? "arm_pid_rom" : \
+ "arm_pid_romram" }
cdl_option CYGHWR_MEMORY_LAYOUT_LDI {
display "Memory layout linker script fragment"
@@ -311,7 +312,8 @@
no_define
define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_pid_ram.ldi>" : \
- "<pkgconf/mlt_arm_pid_rom.ldi>" }
+ CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_pid_rom.ldi>" : \
+ "<pkgconf/mlt_arm_pid_romram.ldi>" }
}
cdl_option CYGHWR_MEMORY_LAYOUT_H {
@@ -320,7 +322,8 @@
no_define
define -file system.h CYGHWR_MEMORY_LAYOUT_H
calculated { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_pid_ram.h>" : \
- "<pkgconf/mlt_arm_pid_rom.h>" }
+ CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_pid_rom.h>" : \
+ "<pkgconf/mlt_arm_pid_romram.h>" }
}
}
Index: hal/arm/pid/current/include/hal_platform_setup.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/pid/current/include/hal_platform_setup.h,v
retrieving revision 1.4
diff -u -r1.4 hal_platform_setup.h
--- hal_platform_setup.h 2000/02/02 19:57:07 1.4
+++ hal_platform_setup.h 2001/02/15 20:00:18
@@ -59,10 +59,31 @@
#endif
#define MEM_RESET 0x0B000020 // Write to this location to enable RAM
+#define CYGHWR_HAL_RAM_VADDR 0x00008000
+#if defined(CYG_HAL_STARTUP_ROMRAM)
+#define RELOCATE_TEXT_SEGMENT \
+ ldr r2,=__exception_handlers ;\
+ ldr r3,=CYGMEM_REGION_rom ;\
+ cmp r2,r3 ;\
+ beq 20f ;\
+ ldr r4,=_end ;\
+15: ;\
+ ldr r0, [r3], #4 ;\
+ str r0, [r2], #4 ;\
+ cmp r2, r4 ;\
+ bne 15b ;\
+ b __new_pc ;\
+__new_pc: ;\
+20:
+#else
+#define RELOCATE_TEXT_SEGMENT
+#endif
+
#define PLATFORM_SETUP1 \
ldr r0,=MEM_RESET /* enable RAM */ ;\
- str r0,[r0]
+ str r0,[r0] ;\
+ RELOCATE_TEXT_SEGMENT
/*---------------------------------------------------------------------------*/
/* end of hal_platform_setup.h */
Index: hal/arm/pid/current/src/hal_diag.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/arm/pid/current/src/hal_diag.c,v
retrieving revision 1.13
diff -u -r1.13 hal_diag.c
--- hal_diag.c 2001/02/13 01:23:23 1.13
+++ hal_diag.c 2001/02/15 20:00:18
@@ -427,7 +427,7 @@
// Assumption: all diagnostic output must be GDB packetized unless this is a ROM (i.e.
// totally stand-alone) system.
-#if defined(CYG_HAL_STARTUP_ROM) || !defined(CYGDBG_HAL_DIAG_TO_DEBUG_CHAN)
+#if defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYG_HAL_STARTUP_ROM) || !defined(CYGDBG_HAL_DIAG_TO_DEBUG_CHAN)
#define HAL_DIAG_USES_HARDWARE
#endif
mlt_files_pid_romram.tgz