Let's get started with a Pandora port
Pages: 1 2 3 4 5 6 7 8 9 10 11 ... 22
Andrew Chamberlain (165) 74 posts |
The Pandora handheld computer/console is now available for preorder. I doubt we’ll get a better target for RISC OS than this. Who wants to get cracking? |
Andrew Chamberlain (165) 74 posts |
Link is here – http://www.openpandora.org/ |
David Thorn (193) 8 posts |
Ok – I have a Pandora on pre-order. If someone is willing to port RISC OS to it, I will buy another and gift it to the porter. |
Andrew Chamberlain (165) 74 posts |
That’s a good offer. Do you want to post this on comp.sys.acorn and see if you get any takers? |
Holger Kipp (203) 1 post |
I can only second the idea of porting RiscOS to Pandora (as I also have a Pandora on pre-order and some RiscOS-systems at home). What would be needed to get such a task going? |
Jeffrey Lee (213) 6048 posts |
I’m guessing no-one’s actually started work on this yet? Although I don’t personally want to run RISC OS on the Pandora, I would like to see it running on one of the ARM netbooks that are due out this year, so I feel that it is important that we start work on a port to Cortex-A8 platforms. With regards to that, I think developers have three choices:
|
Ben Avison (25) 445 posts |
Well not me, anyway.
The closest I’ve personally come to bringing up RISC OS on a new board was tweaking the IOMD HAL just before Christmas to run on an A7000 rather than the Risc PC it was written for; this was without a JTAG of course, and I have to say it was a painful experience. Outside the RISC OS world, I’ve used JTAGs (and the associated runtime debugger runnning on a host system) and also worked on systems where JTAGs were not available, and I have to say I’d always choose the JTAG option whenever available for any low-level work, or even complex software such as codecs. I’m not familiar enough with qemu to say whether it provides equivalent debugging access to the emulated system, and I’d also be a little wary developing for an emulator in the sense that it may have bugs in the emulation, and it’s unlikely to emulate certain aspects of the hardware such as PLL registers. Its big advantage is the price, of course. Acorn used emulators in the development of the Risc PC - but this was before the likes of JTAGs were commonplace. All the new CPU support and HALs developed by Pace and Tematic were brought to life using JTAGs. Also, in all cases except the Iyonix, the first port to any given chip family (let alone each new CPU core) was always done first to a development board – and even then, the XScale core support was initially implemented on an 80200 development board by Pace, so we only had to write support for the IOP chip family from scratch for the Iyonix. The Beagle Board appears to be a development board for the TI OMAP-3 chip family, so I’d definitely target it before the Pandora. I’d add that it’s a risk attempting to jump straight to Cortex-A8, especially when so much experience of porting the OS has been lost. RISC OS has always been developed incrementally, and currently supports ARM-6, ARM-7, ARM-8, StrongARM, ARM-9 and XScale cores. The HAL was first developed for ARM-7 variants which lacked 26-bit mode before we moved on to ARM-9 and XScale devices. If it were up to me, I’d want to do a port to at least one development board based on ARM-10 and ARM-11 before moving on to Cortex.
In early stages of board bringup, it is normal to direct console I/O through a serial port or other UART, especially since keyboards tend to require a functional USB stack these days! Look for the kernel build switch
It’s highly unlikely that it’s appropriate to have a single HAL for all Cortex-A8 devices. Cortex-A8 only defines the CPU core and associated hangings-on like caches. The OMAP3530 will contain a large amount of silicon designed by TI which won’t be present on any Cortex-based devices made by other ARM licencees. I’d say that the obvious device bracket to code into one HAL would be TI’s OMAP-3 family. The bulk of the HAL code for an OMAP3530 board (such as Beagle or Pandora) would be the same as that for an OMAP3503, OMAP3515 or OMAP3525 board. Bear in mind that the HAL contains the low-level (nominally OS-independent) driver code for all devices on the main board, and since all these devices are integrated onto the same die, any such boards can’t help but share the same driver code. In an ideal world, it would be possible for the HAL to probe the board at run-time and determine which variant it is (perhaps for fit/no-fit options for connectors). Acorn always ensured that it was possible to do this – witness that the same OS ROM chips will work in any Risc PC, A7000 or A7000+ despite significant specification differences – but as we found out for some of Castle’s ARM-9 designs, it’s not always possible to distinguish different third-party boards at run-time and you have to drop back to build-time variants. Build-time switches are set in the Components file (RiscOS/BuildSys/Components/...). I’d also point out that a chunk of the porting work would be need to be to the kernel as well as to the HAL. This is because support for CPU core architectures was deliberately kept in the kernel (to avoid lots of code duplication between HALs for different chips with the same core). This means things like cache management and page tables, both of which may have had significant changes – I note from my brief examination of its specs that the OMAP3530 has a L2 cache, for example.
I’m not that familiar with the interface between Linux and its bootloaders, but I don’t think it’s a good fit with RISC OS really. It is my understanding that the model is similar to what happens when we run a soft-loaded OS - the bootloader (like the underlying ROM OS) sets up the hardware to the point when it can mount a filing system on some non-volatile storage – disc, SD card or just a partition on the NAND flash – and extract and run files from that filing system which constitute the OS proper (like the softloaded OS in my analogy). I’m not sure whether any of the driver code from the Linux bootloader is used once the OS is running, or whether there is duplicate driver code in Linux. RISC OS ROMs are still 4 – 8 MB in size, and are not file-based; the constituent modules are concatenated (for assembler) or linked (for C) together. The HAL acts as a low-level bootloader – initialising clocks, the RAM controller, assigning addresses on the PCI bus (if present) etc. But it doesn’t need to get as heavyweight as a Linux bootloader because the OS image is invariably small enough to fit on the same boot device as the HAL - filing systems don’t need to be brought up until after the kernel is running, not before. The HAL also provides both information for the running kernel (such as tables of physical RAM layout) and a series of code entry points to do various bits of low-level jiggery pokery. I imagine you could launch a soft-loaded RISC OS HAL+OS image from a Linux bootloader if you wanted to. You could then omit the bootloader aspects from the HAL (RAM controller initialisation’s an important one for soft-loaded code!) but you’d still need an implementation of all the HAL entry points to the API that RISC OS expects, and that’s usually the bulk of the work. If the Linux bootloader provides equivalent functionality then it’s possible a translation layer could be written, but such things usually hurt efficiency, and if the volatility of the rest of the Linux kernel API is anything to go by, it would present an ongoing maintenance headache. Also note that there is flash recovery code in the Iyonix HAL which is probably largely re-usable in other HALs, so that’s another aspect of the Linux bootloader that we don’t need.
That’s a surprisingly short list, we’ve had functioning ROMs with little more than the HAL and Kernel, possibly including FileSwitch, ResourceFS, Messages and MessageTrans to get token lookup working too. You’d normally need to include various other modules in the component file (labelled as
Well, it’s a start…
There are some things – like touch screen drivers – that were developed by Pace but have never seen the light of day by ordinary desktop users. I’d like to plead that if people are going to write drivers for generic hardware types which are new to RISC OS - such as MMC/SDIO controllers, camera controllers etc – that they take a look at the “NewAPI” HAL docs. There was a long-term plan to move the majority of drivers over to this “HAL device” API, and it makes sense for any new drivers to start from this point. There are lots of nice things about the HAL device API that are missing from the earlier generation, particularly the support for expansion cards (whose drivers are implemented as modules, not by the HAL), hot-pluggability and device suspend/hibernate support that’s particularly important for portable devices (like Pandora, for example). Yet, to date, only DMA and audio mixing have been implemented to the HAL device API.
I’m probably the sort of person you’d want on board, but I have very little free time, much of which get soaked up by ROOL admin and show preparation, and if a Pandora port went ahead, I expect I’d spend a lot of time advising people rather than writing much myself. And I do think you’d need a team of people to attempt this; previous ports have neeeded 1-4 full-time engineers for at least a few weeks to get as far as the command prompt, and this would be an ambitious port with inexperienced and probably spare-time programmers. |
Jeffrey Lee (213) 6048 posts |
Well, you’ll be pleased/alarmed to hear that despite the potential problems, I’ve started work on this project.
Yes, I am aware that the emulation may not be as accurate as required. But until the real machines I’m interested in are released (the Cortex based netbooks), qemu is at the right price point. If I run into problems later on (or safely testing kernels on the netbook looks too hard) I can always buy a dev board then.
I’ve heard similar advice elsewhere. If I encounter any serious problems I’ll consider porting to something simpler first, but as far as I can tell there won’t be any major issues (Not that I’ve examined all the documentation in detail yet).
I’d spotted HAL_DebugRX and HAL_DebugTX, and was wondering whether they’d be useful. Thanks for the info!
Yes, that would make sense. At the moment my HAL is called ‘Beagle’, but I suspect it will run on most OMAP-3 boards with little hassle.
I haven’t looked in detail at the cache/MMU yet, but I suspect that will be where most of my headaches will lie with getting a working kernel. The process for the beagleboard appears to be:
U-Boot is a relatively flexible & user-friendly bootloader, which I suspect is why they’ve chosen it as the executable for x-loader to load, as it will allow you to switch to a different linux kernel/boot device if you break your default one. It also looks like it’s the only way to boot a linux kernel on the device (unless you replace x-loader), since x-loader won’t know to load the ramdisk or pass the kernel its initialisation arguments. Initially I tried writing some test code which replaced the linux kernel image that U-Boot loads, but that was foiled by U-Boot’s header checks (since my code didn’t have any headers). So then I replaced U-Boot and had x-loader load my code directly, which resulted in my desired stream of characters being output over the serial port.
Linux will take over full control of the system once its kernel has started. This also means that U-Boot (and x-loader) leave the system in a relatively clean state ready for Linux to take over. So as far as I know there shouldn’t be much work needed to modify a softload-aware RISC OS ROM image to be bootable from a Linux bootloader. It also makes life a bit easier for the HAL, since it won’t have to worry about initialising the system features that the bootloader will have set up already (e.g. RAM).
I suspect it will be a long time before I get to implementing MMC/SDIO drivers, but I’ll certaintly take a look at expanding the HAL when the time comes.
Advice is always welcome! :) In a few days I’m hoping to have a working HAL. Then I’ll have a go at writing a simple testbed ontop of/inside that, to make sure it actually works how it’s expected. Then I’ll move on to looking at the kernel and trying to package it up into a ROM image. Even if I do fail miserably, we’ll at least have a working Cortex-A8/OMAP HAL upon which future attempts can be based. |
Uwe Kall (215) 120 posts |
That sounds good to me. So let’s DoIt. I’d like to help in this. Will there be a separate repository? When, where? I have a beagle board here and am in the process of getting it connected to my local network to use it as development machine/target under angstrom. I also plan to ‘update’ to a pandora as soon as they are available. |
Jeffrey Lee (213) 6048 posts |
Excellent!
Unless the ROOL team offer to host our development code while we work on it, I suspect we’ll have to set up our own hosting somewhere. SourceForge, riscos.info, etc. – I’m not really bothered where we host it, but obviously somewhere with source control would be better than without. So if you’ve got any preferences on where to host just say so.
Well I’m still using QEMU, so I guess your first job will be to make sure my code actually runs on a real device ;) But if it turns out that QEMU’s emulation is too poor for me to use for development then I’ll gladly spend some money on getting a real dev board. A brief progress update, then:
After finishing & testing the HAL I was planning on going on to look at each of the RISC OS kernel source files in detail, to track down all the machine-dependent bits that need changing. I suspect this would be the first opportunity we’d have to work in parallel on the project (assuming we have our source control set up by then). As far as documentation goes, so far I’ve been going by the following:
|
Ben Avison (25) 445 posts |
We’d be more than happy to do that! Although most people send us code updates as patches that “the management” end up committing to the repository, we always meant for a wider group of developers to get involved – that’s why we have a publicly accessible repository and all this supporting website rather than just a set of tarballs on an ftp server. In cases like this where multiple developers are working on the same code, you really want to be using source control – so I’d encourage anyone getting involved to email us their public SSH key and a scrambled CVS password (ask if you don’t know what I mean by that) and we’ll set you up with an SSH tunnel to our host and a writable account on CVS. RISC OS has had an unfortunate history of fragmenting when held in different repositories and we can really do without spending precious time on doing manual merging across different repositories when a central CVS can do it for us. I’d suggest that changes to the kernel go on a development branch until we’re fairly happy that it’s stable again – otherwise we risk breaking Iyonix builds. But most of the other modules should be able to remain unchanged – all the hardware-specific bits should be in the HAL (remember the HAL contains lots of runtime driver code as well as bootstrapping, so I’m afraid your “90% complete” estimate is probably a bit on the high side).
You’ll definitely want the v7A ARM ARM. As long as you’re not working for one of their competitors, they seem pretty happy to hand them out, but they do insist that it’s a single-user document, so you’ll have to ask for one each. Say you’re doing work for RISC OS Open if you like. One other thing: I know that the ROM build process can be a bit daunting at first. Would you like me to put together a bare bones OMAP3 ROM build? |
Ben Avison (25) 445 posts |
I’ve written a brain dump on ROM builds here which I hope you’ll find useful. My offer to create initial versions of all the necessary files still stands. |
Jeffrey Lee (213) 6048 posts |
What kind of things would we be needing the SSH access for? (I’m guessing we’re using pserver CVS access, but it’s been a long time since I’ve used CVS so correct me if I’m wrong)
Yes, I think I meant to qualify that statement with ”...from the point of view of booting the RISC OS kernel”. Working video and audio support can wait!
Yes please! |
Peter Howkins (211) 236 posts |
Can you check in the build product for the 26-bit HEAD RiscPC/A7000 build please? |
Ben Avison (25) 445 posts |
That’s off-topic for this thread, I’ll post a reply in the thread “Previous Risc PC builds (at Pace)”. |
Ben Avison (25) 445 posts |
Yes, we’re using pserver. The problem is that pserver isn’t secure across the Internet (the obfuscated CVS user password is sent in the clear as I understand it), so what we do for remote access is to tunnel a port on the user’s machine to the pserver port on the server over an SSH connection. The reason why we need your public SSH key is to allow you to ssh to the machine without us having to give away the shell password. I should probably elaborate on the CVS password thing if you’re not familiar with it. Nobody has ever got round to inventing a perl -e 'print crypt("mypassword", "randomseedchars")' then getting someone with write access to the server (that is, me, Steve or Andrew) to install that scrambled password for you. I’m suggesting you email it to us, though technically we should use a secure communication channel for that too. Anyway, back to the subject of ROM builds. I’ve got a very minimal build running here with a HAL that just does an infinite loop. I’m part-way through committing the changes to the repository, but I’ve realised I don’t know where to put the HAL (or where to tell the build system to look for it) because I don’t know what licence it’s going to fall under. At a guess, have you been using bits of code or headers from Linux? If so it’s going to have to be GPL, but that also means we’ll have to be careful not to merge in anything that uses the Castle licence. |
Jeffrey Lee (213) 6048 posts |
OK, I’ve mailed the info to the info@... address. Presumably someone there will know what to do with it :)
Everything I’ve used so far has either been existing code under Castle’s license or stuff I’ve written myself. I’ve certainly got no complaints about it all going under Castle’s license. |
Jeffrey Lee (213) 6048 posts |
Doesn’t look like that’s going to work for me:
|
Jeffrey Lee (213) 6048 posts |
Luckily, the lack of ARMv7 ARM doesn’t seem to be a major problem in getting the kernel working. (OK, so this is still under QEMU, and I’m not entirely sure I’ve chosen the correct L1 cache management functions, and the L2 cache is turned off, but it’s a good start) Once I’m done rejoicing I’ll tidy it up a bit and add it to CVS so other people can start getting involved. |
Thomas v.E. (39) 49 posts |
Oooh, This looks already amazing! Keep up the good work! |
Jeffrey Lee (213) 6048 posts |
The code is now in CVS, under the OMAP3Dev product – except for HALTester, which you’ll have to get manually if you want it. HALTester is in castle/RiscOS/Sources/HAL/HALTester. One thing I’m not sure about though is what to do with my todo list – do ROOL have any ideas? I’m thinking that a simple wiki page would serve the basic needs of listing things which haven’t been added to CVS yet (and who’s implementing them). Then, once something is in CVS, the bug tracker (with an appropriate Cortex/OMAP ‘part’) could be used to track any remaining progress to complete the implementation or fix bugs. |
Steve Revill (20) 1361 posts |
Agreed. A wiki page looks like the best solution for this. Great work, BTW! |
Jeffrey Lee (213) 6048 posts |
I’ve started a wiki page – https://www.riscosopen.org/wiki/documentation/pages/Cortex-A8+port I suspect there’s a hundred and one things missing from the task list, so if anyone can think of anything that isn’t explicitly listed, feel free to add it :) |
Ben Avison (25) 445 posts |
There’s potentially a biggie relating to framebuffer formats – as is sadly often the case, the chip expects “deep colour” modes to have the red bits in more significant bit position than the blue bits, when RISC OS has always put them the other way round. Plus, the 16bpp modes can’t be configured to 1:5:5:5 as RISC OS expects, and I’m a little worried that all the alpha bitfields are just that (0 = transparent, max = opaque) whereas RISC OS works the other way round, and I don’t think the alpha bits are paletted. I’ve asked TI about this and haven’t heard back from them yet – it’s probably time I gave them a little prod. Ideally we might be able to get a hardware fix in time for some of these upcoming platforms, since the alternatives are unpleasant:
Given that the whole RGB vs BGR issue has plagued RISC OS for some time, maybe now’s the time to bite the bullet. We already have hardware platforms with software-switchable RGB/BGR ordering (later Iyonix graphics cards). We already have hardware platforms that support both 1:5:5:5 and 0:5:6:5 bit layouts for 16bpp modes (VIDC machines). Is there the enthusiasm to do this? |
Jeffrey Lee (213) 6048 posts |
The pixel formats aren’t going to be an immediate issue for the OMAP port. Although all the pixel formats are RGB ordering instead of BGR, there’s a 3×3 colour phase conversion matrix which can easily be used to swap the red and the blue channels of the pixel data as it leaves the graphics pipeline. Unfortunately it only applies to the LCD output, not the TV-out – but I doubt many people would be interested in TV-out anyway. Regarding the alpha values – there’s a suitable 32bpp mode available where the pixels don’t have an alpha channel. The alpha is instead forced to 255 (i.e. fully opaque). Plus there are two blending modes supported by the overlay manager – alpha mode and ‘normal’ mode, which uses a transparency colour key. So there are two solutions to that problem. The only problem that can’t be solved in a simple manner is the lack of a suitable 16bpp pixel format. I think the best long-term goal would be to start extending the OS so that new pixel formats can be easily supported. If we also provide functionality for emulating unsupported pixel formats (by software/hardware conversion of a fake off-screen framebuffer) then we can also support new hardware without (severely) punishing users who rely upon old, incompatible software. |
Pages: 1 2 3 4 5 6 7 8 9 10 11 ... 22