Author: wmb Date: Tue Jun 14 04:17:05 2011 New Revision: 2271 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2271
Log: OLPC XO-1.75 trac #10884 - Nandblaster for ARM.
Added: cpu/arm/bootascall.fth cpu/arm/olpc/1.75/mcastnand.bth cpu/arm/olpc/1.75/mcnand-version.fth Modified: cpu/arm/centry.fth cpu/arm/olpc/1.75/config.fth cpu/arm/olpc/1.75/fw.bth cpu/arm/olpc/1.75/olpc.bth cpu/x86/pc/olpc/via/mcastnand.bth
Added: cpu/arm/bootascall.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/arm/bootascall.fth Tue Jun 14 04:17:05 2011 (r2271) @@ -0,0 +1,135 @@ +\ See license at end of file +purpose: Return from "booted" programs as if they were Forth words + +variable rp-var +variable sp-var +rs-size buffer: rs-buf +ps-size buffer: ps-buf + +code save-forth-state ( -- ) + \ Copy the entire Forth data stack and return stack areas to a save area. + + \ Copy Data Stack + set r0,`'user# sp-var` + str sp,[up,r0] \ Save data stack pointer + + ldr r1,'user sp0 \ Top of data stack area + dec r1,`ps-size \ Bottom of data stack area + + set r0,`'user# ps-buf` + ldr r2,[up,r0] \ Address of data stack save area + + mov r3,`ps-size #` \ Size of data stack area + begin + decs r3,4 + ldr r0,[r1,r3] + str r0,[r2,r3] + 0= until + + + \ Return Stack + set r0,`'user# rp-var` + str rp,[up,r0] \ Save return stack pointer + + ldr r1,'user rp0 \ Top of return stack area + dec r1,`rs-size \ Bottom of return stack area + + set r0,`'user# rs-buf` + ldr r2,[up,r0] \ Address of return stack save area + + mov r3,`rs-size #` \ Size of return stack area + begin + decs r3,4 + ldr r0,[r1,r3] + str r0,[r2,r3] + 0= until +c; + +: undo-boot-return ( -- ) + ['] (quit) to user-interface +; + +code resume-forth-state ( -- ) + mrs r0,cpsr + orr r0,r0,#0x80 \ Set interrupt disable bit + msr cpsr,r0 + + \ Restore Data Stack + set r0,`'user# sp-var` + ldr sp,[up,r0] \ Save data stack pointer + + ldr r1,'user sp0 \ Top of data stack area + dec r1,`ps-size \ Bottom of data stack area + + set r0,`'user# ps-buf` + ldr r2,[up,r0] \ Address of data stack save area + + mov r3,`ps-size #` \ Size of data stack area + begin + decs r3,4 + ldr r0,[r2,r3] + str r0,[r1,r3] + 0= until + + + \ Restore Return Stack + set r0,`'user# rp-var` + ldr rp,[up,r0] \ Save return stack pointer + + ldr r1,'user rp0 \ Top of return stack area + dec r1,`rs-size \ Bottom of return stack area + + set r0,`'user# rs-buf` + ldr r2,[up,r0] \ Address of return stack save area + + mov r3,`rs-size #` \ Size of return stack area + begin + decs r3,4 + ldr r0,[r2,r3] + str r0,[r1,r3] + 0= until + + mrs r0,cpsr + bic r0,r0,#0x80 \ Clear interrupt disable bit + msr cpsr,r0 + + pop ip,rp +c; + +0 value saved-go-hook +: boot-as-call( ( -- ) + ps-buf drop rs-buf drop + ['] go-hook behavior to saved-go-hook + ['] save-forth-state to go-hook + ['] resume-forth-state to user-interface +; +: )boot-as-call ( -- ) + saved-go-hook to go-hook + ['] (quit) to user-interface +; +ps-buf drop rs-buf drop +: foo boot-as-call( emacs )boot-as-call cr ." Hello" cr ; + +\ LICENSE_BEGIN +\ Copyright (c) 2010 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Modified: cpu/arm/centry.fth ============================================================================== --- cpu/arm/centry.fth Tue Jun 14 04:10:25 2011 (r2270) +++ cpu/arm/centry.fth Tue Jun 14 04:17:05 2011 (r2271) @@ -34,7 +34,7 @@
ldr rp,'user rp0 \ Set return stack pointer ldr sp,'user sp0 \ Set data stack pointer - inc sp,1cell \ Account for the top of stack register + \ We don't increment sp because there is one item on the stack, in tos
adr ip,'body cif-exec \ Set interpreter pointer c;
Modified: cpu/arm/olpc/1.75/config.fth ============================================================================== --- cpu/arm/olpc/1.75/config.fth Tue Jun 14 04:10:25 2011 (r2270) +++ cpu/arm/olpc/1.75/config.fth Tue Jun 14 04:17:05 2011 (r2271) @@ -3,6 +3,7 @@ create olpc create trust-ec-keyboard create use-null-nvram +create use-elf
fload ${BP}/cpu/arm/olpc/1.75/addrs.fth fload ${BP}/cpu/arm/mmp2/hwaddrs.fth
Modified: cpu/arm/olpc/1.75/fw.bth ============================================================================== --- cpu/arm/olpc/1.75/fw.bth Tue Jun 14 04:10:25 2011 (r2270) +++ cpu/arm/olpc/1.75/fw.bth Tue Jun 14 04:17:05 2011 (r2271) @@ -260,9 +260,7 @@ ' pre-setup-for-linux to linux-pre-hook
: show-temperature ( -- ) ; -: boot-as-call( ( -- ) ." Implement boot-as-call" cr ; -: )boot-as-call ( -- ) ; -\ fload ${BP}/cpu/x86/bootascall.fth +fload ${BP}/cpu/arm/bootascall.fth create use-thinmac fload ${BP}/cpu/x86/pc/olpc/wifichannel.fth fload ${BP}/cpu/x86/pc/olpc/via/nbtx.fth
Added: cpu/arm/olpc/1.75/mcastnand.bth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/arm/olpc/1.75/mcastnand.bth Tue Jun 14 04:17:05 2011 (r2271) @@ -0,0 +1,30 @@ +purpose: Fetch and compile the multicast NAND reflash program + +command: &builder &this +build-now + +fload ${BP}/cpu/arm/olpc/1.75/mcnand-version.fth + +1 [if] + " ${MCNAND_VERSION}" expand$ " test" $= [if] + " multicast-nand/Makefile" $file-exists? 0= [if] + " git clone -q git://dev.laptop.org/users/wmb/multicast-nand" expand$ $sh + [then] + [else] + " rm -rf multicast-nand" $sh + " wget -q -O multicast-nand.tar.gz http://dev.laptop.org/git/users/wmb/multicast-nand/snapshot/multicast-nand-$..." expand$ $sh + " tar xfz multicast-nand.tar.gz" $sh + " mv multicast-nand-${MCNAND_VERSION} multicast-nand" expand$ $sh + " rm multicast-nand.tar.gz" $sh + [then] + + " (cd multicast-nand; make BPDIR=../../../../../.. OFW_CPU=arm nandblaster15_rx.bin nandblaster_tx.bin; cp nandblaster15_rx.bin nandblaster_tx.bin ..)" expand$ $sh +[else] + " (cd /home/wmb/Git/multicast-nand; make BPDIR=/home/wmb/ofw.test OFW_CPU=x86 nandblaster15_rx.bin nandblaster_tx.bin;)" $sh + " cp /home/wmb/Git/multicast-nand/*blaster*.bin ." expand$ $sh +[then] + +\ This forces the creation of a .log file, so we don't re-fetch +writing mcastnand.version +" ${MCNAND_VERSION}"n" expand$ ofd @ fputs +ofd @ fclose
Added: cpu/arm/olpc/1.75/mcnand-version.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/arm/olpc/1.75/mcnand-version.fth Tue Jun 14 04:17:05 2011 (r2271) @@ -0,0 +1,8 @@ +\ The multicast NAND updater code version +\ Use a specific git commit ID for a formal release or "test" for development. +\ With a specific ID, mcastnand.bth will download a tarball without .git stuff. +\ With "test", mcastnand.bth will clone the git head if build/multicast-nand/ +\ is not already present, then you can modify the git subtree as needed. +macro: MCNAND_VERSION 3975692c3311749185ec1ecba706388e3924a284 +\ macro: MCNAND_VERSION test +\ macro: MCNAND_VERSION HEAD
Modified: cpu/arm/olpc/1.75/olpc.bth ============================================================================== --- cpu/arm/olpc/1.75/olpc.bth Tue Jun 14 04:10:25 2011 (r2270) +++ cpu/arm/olpc/1.75/olpc.bth Tue Jun 14 04:17:05 2011 (r2271) @@ -3,6 +3,7 @@ command: &builder &this in: ${BP}/cpu/arm/olpc/1.75/build/fw.img in: ${BP}/cpu/arm/olpc/1.75/build/resetvec.img +in: ${BP}/cpu/arm/olpc/1.75/build/mcastnand.bin in: sd8686.bin in: verify.img in: ${BP}/dev/usb2/device/hub/build/hub.fc @@ -143,10 +144,9 @@ " ${BP}/cpu/x86/pc/olpc/images/leds.di" $add-file " ${BP}/cpu/x86/pc/olpc/images/ebook.di" $add-file
+ " ${BP}/cpu/arm/olpc/1.75/build/nandblaster15_rx.bin" " nb15_rx" $add-deflated-dropin + " ${BP}/cpu/arm/olpc/1.75/build/nandblaster_tx.bin" " nb_tx" $add-deflated-dropin 0 [if] - " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster15_rx.bin" " nb15_rx" $add-deflated-dropin - " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster_tx.bin" " nb_tx" $add-deflated-dropin - " ${BP}/cpu/x86/pc/olpc/images/tux.565" " tux.565" $add-deflated-dropin " ${BP}/cpu/x86/pc/olpc/images/settings.565" " settings.565" $add-deflated-dropin [then]
Modified: cpu/x86/pc/olpc/via/mcastnand.bth ============================================================================== --- cpu/x86/pc/olpc/via/mcastnand.bth Tue Jun 14 04:10:25 2011 (r2270) +++ cpu/x86/pc/olpc/via/mcastnand.bth Tue Jun 14 04:17:05 2011 (r2271) @@ -6,22 +6,22 @@ fload ${BP}/cpu/x86/pc/olpc/via/mcnand-version.fth
1 [if] -" ${MCNAND_VERSION}" expand$ " test" $= [if] - " multicast-nand/Makefile" $file-exists? 0= [if] - " git clone -q git://dev.laptop.org/users/wmb/multicast-nand" expand$ $sh + " ${MCNAND_VERSION}" expand$ " test" $= [if] + " multicast-nand/Makefile" $file-exists? 0= [if] + " git clone -q git://dev.laptop.org/users/wmb/multicast-nand" expand$ $sh + [then] + [else] + " rm -rf multicast-nand" $sh + " wget -q -O multicast-nand.tar.gz http://dev.laptop.org/git/users/wmb/multicast-nand/snapshot/multicast-nand-$..." expand$ $sh + " tar xfz multicast-nand.tar.gz" $sh + " mv multicast-nand-${MCNAND_VERSION} multicast-nand" expand$ $sh + " rm multicast-nand.tar.gz" $sh [then] -[else] -" rm -rf multicast-nand" $sh -" wget -q -O multicast-nand.tar.gz http://dev.laptop.org/git/users/wmb/multicast-nand/snapshot/multicast-nand-$..." expand$ $sh -" tar xfz multicast-nand.tar.gz" $sh -" mv multicast-nand-${MCNAND_VERSION} multicast-nand" expand$ $sh -" rm multicast-nand.tar.gz" $sh -[then]
-" (cd multicast-nand; make BPDIR=../../../../../../.. nandblaster15_rx.bin nandblaster_tx.bin; cp nandblaster15_rx.bin nandblaster_tx.bin ..)" expand$ $sh + " (cd multicast-nand; make BPDIR=../../../../../../.. OFW_CPU=x86 nandblaster15_rx.bin nandblaster_tx.bin; cp nandblaster15_rx.bin nandblaster_tx.bin ..)" expand$ $sh [else] -" (cd /home/wmb/Git/multicast-nand; make BPDIR=/home/wmb/ofw.test nandblaster15_rx.bin nandblaster_tx.bin;)" $sh -" cp /home/wmb/Git/multicast-nand/*blaster*.bin ." expand$ $sh + " (cd /home/wmb/Git/multicast-nand; make BPDIR=/home/wmb/ofw.test OFW_CPU=x86 nandblaster15_rx.bin nandblaster_tx.bin;)" $sh + " cp /home/wmb/Git/multicast-nand/*blaster*.bin ." expand$ $sh [then]
\ This forces the creation of a .log file, so we don't re-fetch