This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
PID ROM/RAM bootup support
- To: ecos-discuss at sources dot redhat dot com
- Subject: [ECOS] PID ROM/RAM bootup support
- From: "Dave Airlie" <airlied at parthus dot com>
- Date: 5 Feb 2001 20:25:58 +0000
Hi,
Please find attached some PID ROM/RAM bootup code,
the tgz contains the ROM/RAM mlt files (similiar to RAM files with some
ROM stuff added) I've no idea if these will auto-generate correctly,
and a diff -u containing the changes to the hal I've made to support it,
there is still one dodgy point in the diffs for UNMAPPED_PTR, I'm using a
define from hal_platform_setup.h PID_RAM_BASE=0x8000 to decide how much I
need to subtract for the write vector.. this doesn't seem the Right Way to
do things, but it is the only way I can get the correct address for the
reset vector..
This is due to RAM starting at 0 but the code starting at 0x8000,
This builds code that can boot on the PID ROM get copied to RAM and
execute..
Regards,
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
mlt_files_pid_romram.tgz
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.34
diff -u -r1.34 vectors.S
--- vectors.S 2001/01/26 08:15:27 1.34
+++ vectors.S 2001/02/05 19:04:50
@@ -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
@@ -112,10 +113,16 @@
#ifdef CYGHWR_HAL_ARM_HAS_MMU
#define UNMAPPED(x) ((x)-__exception_handlers)
+#elif defined(CYG_HAL_STARTUP_ROMRAM)
+#ifdef PID_RAM_START
+#define UNMAPPED(x) ((x)-CYGMEM_REGION_ram+CYGMEM_REGION_rom-PID_RAM_START)
#else
+#define UNMAPPED(x) ((x)-CYGMEM_REGION_ram+CYGMEM_REGION_rom)
+#endif
+#else
#define UNMAPPED(x) (x)
#endif
-
+
#define UNMAPPED_PTR(name) \
.##name: .word UNMAPPED(name)
@@ -303,7 +310,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
@@ -311,6 +318,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
@@ -324,6 +332,7 @@
cmp r4,r5
bne 1b
2:
+#endif
#endif
// initialize interrupt/exception environments
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.5
diff -u -r1.5 hal_arm_pid.cdl
--- hal_arm_pid.cdl 2000/08/25 17:32:54 1.5
+++ hal_arm_pid.cdl 2001/02/05 19:04:51
@@ -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
@@ -301,7 +301,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"
@@ -309,7 +310,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 {
@@ -318,7 +320,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/05 19:04:55
@@ -59,10 +59,32 @@
#endif
#define MEM_RESET 0x0B000020 // Write to this location to enable RAM
+#define PID_RAM_START 0x00008000
+#define PID_ROM0_START 0x04000000
+#if defined(CYG_HAL_STARTUP_ROMRAM)
+#define RELOCATE_TEXT_SEGMENT \
+ ldr r2,=PID_RAM_START ;\
+ ldr r3,=PID_ROM0_START ;\
+ 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.12
diff -u -r1.12 hal_diag.c
--- hal_diag.c 2000/07/17 14:42:29 1.12
+++ hal_diag.c 2001/02/05 19:04:55
@@ -431,7 +431,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_DISABLE_GDB_PROTOCOL)
+#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) || defined(CYGDBG_HAL_DIAG_DISABLE_GDB_PROTOCOL)
#define HAL_DIAG_USES_HARDWARE
#endif