Porting to HPPA (PA-RISC) [solved]

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Porting to HPPA (PA-RISC) [solved]

Post by Combuster »

I recently saved a HPPA machine from the computer graveyard, with the intention of making a port for it. (All i have is a large collection of x86s and some embedded devices, so supporting a new architecture is completely new to me) So i decided to give it a try.

However, things didnt run as smoothly as i expected: the linux ports all manage to get into a kernel panic. The 64 bit kernels wont even get to a panic...
To make things worse: a cross-compiled GAS (2.17) won't assemble the standard bootloader (called PALO), GCC doesn't compile (3.4.4, 4.1.1), and all of PALO sources contain too few comments to deduce their actual workings. And HP's docs aren't that great a source of information.

Summarized, i'm stuck without development tools and no really practical information.

Does anybody here have any experience with the HPPA architecture or any other clues as to what goes wrong?

Edit: solution details near the bottom.
Last edited by Combuster on Sun Dec 02, 2007 3:07 pm, edited 1 time in total.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

I know, you hate me etc etc..

But in any sense, I would recommended checking out the NetBSD or OpenBSD HPPA ports.

They might be good code bases to borrow code from here and there...

NetBSD's port supports the hp700 series CPU.
http://www.netbsd.org/Ports/hp700/

Here is the OpenBSD related page.
http://www.openbsd.org/hppa.html

(Not sure if this is useful to you but I'll post it anyway..)
http://www.openbsd.org/hppa64.html

Be sure to look at the bottom of each of the OpenBSD pages, They provide links to various pieces of documentation that might be helpful in your porting effort :)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

Your input is appreciated, but without a toolchain all code sources are pretty much worthless. Apart from that, my box (a D380) isn't supported.

For the information, i've tried compiling the set again under linux, resulting in the same messages. Does anybody know of needed patches or different pa-risc supporting toolchains, since writing my own assembler or having to work around bugs is the last thing i want.
Brynet-Inc wrote:I know, you hate me etc etc..
Most definately NOT - You're just a nuisance picking fights and advocating BSD a few times too often :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
TheQuux
Member
Member
Posts: 73
Joined: Sun Oct 22, 2006 6:49 pm

Post by TheQuux »

Hmmm... I know that the the UCLA LUG managed to get Debian onto a bunch of HPPA's, and they (IIRC) said that they hadn't run into any problems. Not sure what model they were, though...
My project: Xenon
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Post by df »

i used to have like a c340 or something. the hppa boxes had some serious chipset issues and cache issues from what I remember, and with little to no documentation
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

*bump*

I wanted to let you know that I managed to get a basis to solve the problem. I had to patch GCC and read through a lot of mailinglists to get the basics done.

I managed to build a working binutils (2.17) and gcc (4.2.2) with hppa-elf as the target on cygwin. Details in the wiki. Basically it involved trial-and-error composition of a new GCC target (I stole a few details from the hppa-pro target) and patching gcc-x.x.x/gcc/config.gcc.

The GCC output is however very dependent on two components: the gcc support code, and the HPPA millicode. The first is the libgcc.a which is compiled together with GCC, the millicode comprises of the common instructions that are not directly implemented in the CPU (to know, multiplication, division, modulo, and indirect calls), which does not get bundled with gcc. It neither is provided with binutils, nor (g)libc as the google searches suggest. I didn't bother asking Hewlett Packard since it required registration.

Instead, I picked it up from a linux kernel patch, and reading the sources its origin are said to come from GCC, which I just verified did not have it. :shock:
I commited the millicode sources as part of my os development tree for later. You can pick it up there or download the entire source distribution, which is probably easier than downloading the entire linux kernel and applying the patch manually.

With the millicode in place, I could compile and link some test programs as expected. It still chokes on the PALO bootloader - I'll have to check wether it is a remaining gcc thing or that it is missing the symbols for the hppa firmware...

final note: GAS does not work as stated in the manual - it will properly assemble gcc-generated output, but it does not eat the vast majority of pseudo-ops it is said to support.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply