lkml.org 
[lkml]   [1999]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Networking code running in ROM
On Wed, 24 Nov 1999, Bradley D. LaRonde wrote:

> Any reason why the networking code wouldn't like to run in ROM?
>
> I can boot a farily functional kernel from ROM without networking, but with
> networking it fails right after "IP Protocols: ICMP, UDP, TCP". I've traced
> it and it seems to fail in various places inside networking, depending on
> what else I build into the kernel and how I initialize data (copy
> initialzation data to cached or uncached ram).
>
> Oh, there's a twist: I can get it to run with networking in uncached ROM,
> just not with networking in cached ROM.
>
> Any ideas? Does it need special alignment? Does it self-modify? Any thing
> else?
>
> Regards,
> Brad

I have an imbeded system which runs in real RAM, booted off a NVRAM
ram-disk. It does everything its supposed to do including TCP/IP.
So I know it should work. Normally, embeded systems do not execute
out of ROM because it's much slower. Further, how did you get an
executable image into ROM? This seems like a very difficult way
of doing it.

Anyway, many ROM modules can't do byte access. The designers allow
word access only. This will mess up instruction flow with Intel
machines since they have a varible-length instruction set and can
execute off from odd addresses.

My NVRAM machine has 32 64k pages of ROM that has page 0 mapped into
the 0xd000:0 segment, seen during POST. It has the header and is
properly checksummed so that POST calls offset 3 (another odd address)
and my code gets control. It installs it self as a RAM disk, in place
of a floppy, then returns.

When the machine starts to boot, my RAM disk driver emulates a floppy,
properly switching pages as required so that LILO thinks it's a normal
floppy. LILO loads the image, which also contains a RAM Disk which is
mounted as root. I have a program that substitutes for init, which
loads other executables and drivers as required, and starts the
network. The result is a Linux Operating System with application software
that does communications and control via TCP/IP, GPIB, RS-232C, and
firewire (all things to all people). Installable modules talk to devices
on a VXI bus.

Parameters are saved in the last page of NVRAM. They are restored on
the next boot.

This is a session over Telnet.

Script started on Wed Nov 24 16:52:45 1999

# telnet sparks
Trying 204.178.40.137...
Connected to sparks.analogic.com.
Escape character is '^]'.

MCD Platinum(tm) Control System Version 1.00
Copyright(c) 1999-2000, Analogic Corporation
Enter "help" for commands

PLATINUM> help
Commands:
Help
Set binary mode
Set baud rate =
Set IP address =
Set netmask =
Set broadcast address =
Set network address =
Set port =
Set read address =
Set write address =
Set GPIB address =
Set transponder port =
Show baud rate
Show interrupts
Show IO ports
Show IP address
[Enter] to continue...
Show modules (drivers)
Show netmask
Show broadcast address
Show network address
Show port
Show GPIB address
Show status
Show transponder port
Save parameters
Exit monitor
Restart network
Read byte
Read word
Read long
Write byte =
Write word =
[Enter] to continue...
Write long =
Dump =
Dump
Test MIPS
Test integer math
Test real math
Test FFT
^C
PLATINUM> sho status
PID Name Stat CPU Mem Exe Command line
1 (init) S 0.0 800 8 Platinum
2 (kflushd) S 0.0 800 8 Platinum
3 (kpiod) S 0.0 800 8 Platinum
4 (kswapd) S 0.0 800 8 Platinum
10 (monitor) S 0.89 976 12 /sbin/monitor
12 (monitor) S 0.4 976 12 /sbin/monitor
14 (gpib) S 0.0 712 4 GPIB secretary
17 (control) S 0.0 732 12 /sbin/control
25 (server) S 0.0 732 8 /sbin/server
2676 (server) R 0.0 732 8 204.178.40.224
2677 (monitor) S 0.0 968 12 /sbin/monitor
2678 (server) S 0.0 732 8 204.178.40.224
2679 (status) R 0.2 704 4 /sbin/status

PLATINUM> sho modul

gpib_drvr 7436 1
ramdisk 3432 0
3c509 5544 1
PLATINUM> sho iopor

0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0080-008f : dma page reg
00a0-00bf : pic2
00c0-00df : dma2
00f0-00ff : fpu
0200-0207 : Analogic(tm) GPIB driver
02f8-02ff : serial(auto)
0300-030f : 3c509
03c0-03df : vga+
03e0-03e1 : Analogic(tm) Ram Disk Driver
03f8-03ff : serial(auto)
PLATINUM> sho interr

CPU0
0: 295995 XT-PIC timer
1: 2588 XT-PIC keyboard
2: 0 XT-PIC cascade
4: 7899 XT-PIC serial
5: 0 XT-PIC Analogic(tm) GPIB driver
10: 51239 XT-PIC eth0
13: 1 XT-PIC fpu
NMI: 0
ERR: 0
PLATINUM> sho ip add
IP address = 204.178.40.137
PLATINUM> sho gpib add
GPIB address = 2
PLATINUM> set gpib=4
GPIB address = 4
PLATINUM> save
Parameters saved
PLATINUM> exit
Exit

Connection closed by foreign host.
# exit
exit

Script done on Wed Nov 24 16:54:30 1999

This all works and is the method of making embeded systems that I
advise. The system uses only one stick of RAM (4 megabytes). The
RAM disk (mounted as root) is 1440 kB. The executables all use
about 4 kB of RAM and I use shared libraries which are stripped.

The "SHOW STATUS" above is a homemade version of 'ps', made really
small. It shows the tasks that normally execute.

If you are executing anything but boot code out of ROM, I think it's
a poor approach. With the approach cited here, you can grow the system
during the product's lifetime. This is often essential because early
in the development process, few can see far enough into the future
to make initial designs that will handle developing markets.

If you need some hints (and even some code), contact me off-the-list.
Linux makes great embeded systems if you do it right.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.221 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site