Re: Board boots when in BDM, hangs otherwise
From: Richard Hendricks <hidden>
Date: 2000-05-02 21:22:00
Note: This stuff only applies for Metrowerks running bare metal on the FADS board. Here are the instructions:
Changes to PowerPC Runtime Source
Add a __declspec(".init") before "extern void __start(void)" in
__start.c
Remove #pragma code_type ".init" in __start.c
Add the following lines of code to __init_hardware() in
__ppc_eabi_init.c and .cpp right after the nofralloc
/* Our address is really in high Flash ROM space. When reset,
execution
* starts at 0x0100. This code fragment jumps us to the correct
* high memory area */
lis r3, __init_hardware@h /* high address of __start */
ori r3, r3, __init_hardware@l
addi r3, r3, 0x0014 /* Jumps us into the NOPs below */
mtctr r3
bctr
nop
nop
/* Now we need to fix the LR since it points back to 0x0000_010x,
* not 0x0280_010x like it needs to after we muck up the BCSR's */
mflr r3
oris r3, r3, 0x0280
mtlr r3
//Do rest of board setup here, including MSR, IMMR, disable and
invalidate caches, program UPM, ICTRL, DER, and ICR
Chages to PowerPC Runtime Include
Remove declspec from both __init_hardware() and ADSInit() in file
__ppc_eabi_init.h
Next recompile Runtime.
Make sure __ppc_eabi_init in project file points to new modified
version.
Then goto the project you wish to use flash, and change the Code Address
to start at 0x02800100. Since __start is the only function marked as
.init, it will now be at the correct location, 0x0100 during bootup.
The runtime will also work when not flashing.
This will also allow you to run standalone, and with MPC8bug attached by
"go 02800100".I sent them in to Metrowerks, so hopefully their next iteration will work. I have also included my whole _FADS.cpp init file. "Richard Hendricks (ra6353)" wrote:
Jim Lewis wrote:quoted
Hi Josh,..quoted
Ther is one register that the IN command sets that it does not tell you about. That is the ICTRL register, which controls serialization of the core, among other things. On powerup, it is set to SHOW-ALL-INSTRUCTION-FETCH-CYCLES. Some 8xx processors have problems with this. Read the errata. Check to make sure you are setting ICTRL to something like 0x07 in your firmware. -JimThis is also probably the source of your slowdown when running off of BDM. Also make sure the watchdog is disabled (Dan's code does this, I think). If anyone is interested, I can post the startup file I use for running from flash on the FADS board using Metrowerks. I finally figured out a way that I can run the same flash image standalone, and through MPC8bug. -- MPC823 Applications Engineering Development
-- MPC823 Applications Engineering Development
Attachments
- __ppc_eabi_init_FADS.cpp [application/x-unknown-content-type-codewarrior_cpp] 12546 bytes · preview