EC, CForth exploratory commands?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

EC, CForth exploratory commands?

Martin Langhoff
Hi folks!

Yesterday I ran a workshop covering some topics about hw development
and mfg. Using a lot of material from Bunnie's blog, as well as from
my time in the trenches.

As part of it I tried -- and mostly failed -- to give folks a tour of
early boot, using some old boards I have stashed. Here I got truly
lost. I could not find current useful notes on what you can do in the
early CForth env. I could also not find the commands for the EC port
in the wiki, though I do remember issuing commands on that port during
some testing...

I'm more familiar with the full OFW/Forth env so I kind of rescued my
pride there. The attendees got hooked so they're trying to drag me
into a second session in the coming weeks. It would be nice to revisit
EC port and early CForth with commands that actually work :-}

For simplicity sake, let's assume that I'm on XO-4 B1 or later. That's
what I have the most of, and what I suspect is the most interesting
anyway.

thanks in advance...


m
--
 [hidden email]
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Paul Fox-2
martin wrote:
 > part       text/plain                1286
 > Hi folks!
 >
 > Yesterday I ran a workshop covering some topics about hw development
 > and mfg. Using a lot of material from Bunnie's blog, as well as from
 > my time in the trenches.
 >
 > As part of it I tried -- and mostly failed -- to give folks a tour of
 > early boot, using some old boards I have stashed. Here I got truly
 > lost. I could not find current useful notes on what you can do in the
 > early CForth env. I could also not find the commands for the EC port
 > in the wiki, though I do remember issuing commands on that port during
 > some testing...

i think the only reference to those commands may be in the source:
    http://dev.laptop.org/git/users/rsmith/ec-cl4-mmp3/tree/monitor.c#n172

paul

 >
 > I'm more familiar with the full OFW/Forth env so I kind of rescued my
 > pride there. The attendees got hooked so they're trying to drag me
 > into a second session in the coming weeks. It would be nice to revisit
 > EC port and early CForth with commands that actually work :-}
 >
 > For simplicity sake, let's assume that I'm on XO-4 B1 or later. That's
 > what I have the most of, and what I suspect is the most interesting
 > anyway.
 >
 > thanks in advance...
 >
 >
 > m
 > --
 >  [hidden email]
 >  -  ask interesting questions
 >  - don't get distracted with shiny stuff  - working code first
 >  ~ http://docs.moodle.org/en/User:Martin_Langhoff
 > _______________________________________________
 > Devel mailing list
 > [hidden email]
 > http://lists.laptop.org/listinfo/devel

=---------------------
 paul fox, [hidden email]
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

John Watlington

On Apr 13, 2014, at 2:13 PM, Paul Fox wrote:

> martin wrote:
>> Yesterday I ran a workshop covering some topics about hw development
>> and mfg. Using a lot of material from Bunnie's blog, as well as from
>> my time in the trenches.
>>
>> As part of it I tried -- and mostly failed -- to give folks a tour of
>> early boot, using some old boards I have stashed. Here I got truly
>> lost. I could not find current useful notes on what you can do in the
>> early CForth env.

Linked off of the XO-4 model pages:
http://wiki.laptop.org/go/XO_4_Memory_Test
http://wiki.laptop.org/go/Debugging_Open_Firmware_Startup

Cheers,
wad
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

James Cameron-2
In reply to this post by Martin Langhoff
On Sun, Apr 13, 2014 at 01:48:35PM -0400, Martin Langhoff wrote:
> As part of it I tried -- and mostly failed -- to give folks a tour
> of early boot, using some old boards I have stashed. Here I got
> truly lost. I could not find current useful notes on what you can do
> in the early CForth env.

http://wiki.laptop.org/go/Forth_Lesson_20 covers the early boot from
the point the SoC is powered and begins to run the built-in Marvell
bootloader.  Mitch gave the bootloader an SPI FLASH chip with a
structure containing CForth, which is loaded and run.

We have generally used Open Firmware for most discovery after that, as
it is more feature rich.

http://dev.laptop.org/git/users/wmb/cforth/ for CForth source.  You
can work backward from the ofw word.

http://wiki.laptop.org/go/SPI_FLASH_Recovery_for_XO-4_Using_CForth
describes another use for CForth; when we have a corrupted payload in
the SPI FLASH that prevents Open Firmware from starting.

CForth was also very handy for the XO-1.75 watchdog implementation
when we were looking for a cause of kernel hang correlated with
increased use of serial port.  CForth would detect that the processor
had been reset by its watchdog, then power up RAM and dump the kernel
message buffer.

--
James Cameron
http://quozl.linux.org.au/
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Martin Langhoff
On Sun, Apr 13, 2014 at 7:34 PM, Mitch Bradley <[hidden email]> wrote:
> That early work is very detailed and very specific to grotty details

Fantastic info -- thanks!

Part of the story I am exploring is of why someone would want an EC
and a tiny early interactive runtime for debugging (i.e. during bring
up).

In related news, I'm poking around with u-boot for the Novena board
and maybe I'm missing some debugging tricks but it seems much harder
to debug. When it doesn't boot all the way to a working u-boot, well,
it doesn't and that's all you know.

cheers,


m
--
 [hidden email]
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Jon Nettleton
On Mon, Apr 14, 2014 at 2:56 AM, Martin Langhoff
<[hidden email]> wrote:

> On Sun, Apr 13, 2014 at 7:34 PM, Mitch Bradley <[hidden email]> wrote:
>> That early work is very detailed and very specific to grotty details
>
> Fantastic info -- thanks!
>
> Part of the story I am exploring is of why someone would want an EC
> and a tiny early interactive runtime for debugging (i.e. during bring
> up).
>
> In related news, I'm poking around with u-boot for the Novena board
> and maybe I'm missing some debugging tricks but it seems much harder
> to debug. When it doesn't boot all the way to a working u-boot, well,
> it doesn't and that's all you know.

Well the best you are going to get is enabling CONFIG_DEBUG to get
more verbose output.  If the crash is happening really early you can
enable the serial console by hand and use serial_puts, or puts to get
some output.

Otherwise you really need a jtag debugger.
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

John Watlington

On Apr 13, 2014, at 9:19 PM, Jon Nettleton wrote:

> Otherwise you really need a jtag debugger.

Or Open Firmware --- by far the nicest bringup
tool I've ever had the pleasure to use.
It was painful enough using the JTAG debugger to
install Open Firmware.   I would hate to spend weeks
in it.

wad
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Martin Langhoff
On Sun, Apr 13, 2014 at 10:25 PM, John Watlington <[hidden email]> wrote:
>
> On Apr 13, 2014, at 9:19 PM, Jon Nettleton wrote:
>
>> Otherwise you really need a jtag debugger.
>
> Or Open Firmware --- by far the nicest bringup
> tool I've ever had the pleasure to use.

Yup. I'm learning OFW love alright with the kind hand of u-boot.

To be fair, I am getting help from the u-boot maintainers and I am
just kicking the tires and trying to update some board files to latest
u-boot. But in the back of my mind I run through  "how would you use
u-boot in bringup instead of ofw?".

Lots of things I "knew" from discussions with y'all during bringups is
now becoming clearer.

Having the best u-boot hacker in the world would probably would bring
you to a good outcome. And yeah, we had Mitch and OFW...

I still like OFW a whole lot better.

cheers,


m
--
 [hidden email]
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Jon Nettleton
On Mon, Apr 14, 2014 at 5:44 AM, Martin Langhoff
<[hidden email]> wrote:

> On Sun, Apr 13, 2014 at 10:25 PM, John Watlington <[hidden email]> wrote:
>>
>> On Apr 13, 2014, at 9:19 PM, Jon Nettleton wrote:
>>
>>> Otherwise you really need a jtag debugger.
>>
>> Or Open Firmware --- by far the nicest bringup
>> tool I've ever had the pleasure to use.
>
> Yup. I'm learning OFW love alright with the kind hand of u-boot.
>
> To be fair, I am getting help from the u-boot maintainers and I am
> just kicking the tires and trying to update some board files to latest
> u-boot. But in the back of my mind I run through  "how would you use
> u-boot in bringup instead of ofw?".
>
> Lots of things I "knew" from discussions with y'all during bringups is
> now becoming clearer.
>
> Having the best u-boot hacker in the world would probably would bring
> you to a good outcome.

hahaha...I doubt that.  U-boot is such a mess to work with, sometimes
it surprises me it works at all.  BareBox is a much nicer
implementation and Novena and SolidRun will be switching over to it as
soon as I finish my DirectBoot implementation.
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

John Watlington
In reply to this post by Martin Langhoff

On Apr 13, 2014, at 11:44 PM, Martin Langhoff wrote:

> But in the back of my mind I run through  "how would you use
> u-boot in bringup instead of ofw?".

Before OFW, I used assembler code and C debugging shells (think
peek/poke/test mem/run dedicated test functions/boot OS), but I last
did than on single core PPCs.  Once you start talking multiple devices,
cores, caches, interrupt controllers, etc. that approach doesn't scale well.

The basic problem is that you need to be able to quickly modify the code
and test again.  It is hard to beat an interactive language at doing that.

I've watched David Woodhouse use the Linux kernel to do bringup
in a similar manner to Open Firmware, but only he makes it look easy
(and it does require some recompiling and downloading for testing).

Cheers,
wad



_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Jon Nettleton
On Mon, Apr 14, 2014 at 7:21 AM, Mitch Bradley <[hidden email]> wrote:

> Recompiling can work if you fine tune your build and download setup so
> the crank-turn time is very short, like less than a minute.
>
> The very first thing I did when I joined OLPC was to fix the firmware
> downloader.  I was on a conference call with Richard and Jim Gettys and
> some guys from Quanta.  The report was that it took something like 15
> minutes to put in new firmware, using a DOS program that talked to a
> serial download port on the EC that owned the SPI FLASH.  My head
> exploded.  I knew that the hardware was capable of programming that size
> SPI FLASH in less than a minute, so I started looking for bottlenecks
> and quickly found them.
>

I was talking with bunnie and xobs about doing something similar for
the iMX6 platform that bootstraps from SDHC.  Since they had already
reverse-engineered the linux firmware for at least one type of SDHC
card, we figured we could run that on the FPGA and interface the FPGA
out to a microsdhc connection.  This would allow us to compile uboot
and install it to a ramdisk that would be immediately available to the
iMX6 board to attempt to boot and debug.  I will let you know my
initial bringup of the SolidRun boards got me very adept at swapping
microsdhc cards. ;-)

But I do like having the bootloader right on the SDHC card.  Virtually
unbrickable.
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

John Watlington

On Apr 14, 2014, at 1:30 AM, Jon Nettleton wrote:
> But I do like having the bootloader right on the SDHC card.  Virtually
> unbrickable.


But it precludes any of the anti-theft mechanisms that most
of OLPC's customers were looking for.

(anti-theft => keeping the NSA off my laptop/router/TOR box)

wad

_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: EC, CForth exploratory commands?

Martin Langhoff
In reply to this post by John Watlington
On Mon, Apr 14, 2014 at 1:01 AM, John Watlington <[hidden email]> wrote:
> The basic problem is that you need to be able to quickly modify the code
> and test again.  It is hard to beat an interactive language at doing that.

Just got word from u-boot folks and Bunnie -- apparently the Novena
board can boot off USB-OTG, so you can serve the freshly made binary
over USB from your laptop. make/bounce server/reboot.

Glad I learned that before screwing up the uSD slot pins.

I'll test and report back.




m
--
 [hidden email]
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff
_______________________________________________
Devel mailing list
[hidden email]
http://lists.laptop.org/listinfo/devel