User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Thu Nov 22, 2018 3:22 am

Heater wrote:
Thu Nov 22, 2018 3:07 am
Could you elaborate on why your build was failing.

You have no code to look at on the YANGTOS site but judging by the example source quoted there it looks like straight forward C that should be buildable very easily with nothing but gcc and perhaps make.
Yea I am moving a bit slowly towards getting code onto the site, sorry about that.

Most of the code is simple C99 compliant C source, some is ObjAsm Assembly (only where assembly is absolutely needed) that assembles with AsAsm (which is available for ARM Linux, and I have working). Though yet the C compiler chokes on one file (I may know the problem, not sure), and ld does not like my linker scripts (very simple, just puts the .text, .rodata, .data, and .bss sections in order on 1KB boundaries, with the starting load address of 0x8000, and works with the ld included with gcc 4.7.4 binutils on RISC OS). If there were a simpler way to set the entry point at 0x8000 in Linux I may try that. There is a simpler way in RISC OS, though I still chose to use the linker script so as to make it easier to compile on other systems.

All that is where I am. I would like to solve the problem so that I can say it can be compiled from Linux, so if you know something please chime in.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Thu Nov 22, 2018 4:32 am

I just found the problem. This is a face palm moment (extremely obvious). It comes down to file names, may seem strange to those that do not know RISC OS programming tools.

Normally on RISC OS when using filenames that use a name.ext format on other systems, the dot is just translated to/from a forward slash, pretty simple and other systems still see it as a dot. This is because RISC OS (being before such things were a hardened standard) uses the dot '.' to separate directories, in the way that other systems we know use either a forward slash or back slash.

Now for compilers and assemblers things are done differently, I do not know why it is different. This time the file name does not have the extension though instead is in a directory named after the extension. In other words a file like MyProject.Source.Main/c needs to be renamed and moved to MyProject.Source.c.Main to make the compiler and related tools happy. I had correctly reworked the directory structure to work in Linux using a simple BASIC program to change to the filename/ext (which Linux would see as filename.ext) form. The trouble is that I had not included ld in the list of extensions to translate, and that meant that on Linux I still had ./kernel/src/ld/script where the make file was pointing ld at ./kernel/src/script.ld.

To be clear if you tell gcc on RISC OS to gcc -o hello hello.c it will expect the file named hello to be in the subdirectory c in the currently set directory.

That about sums up the problem. As I said I did a face palm on this one, very obvious.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Thu Nov 22, 2018 4:38 am

After correcting the error mentioned in my last post the kernel compiles under Linux without any complaint. I have yet to test boot the new image, though I am fairly confident it will work as well as it did last time I compiled it from RISC OS, as I have not changed anything since.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Thu Nov 22, 2018 4:39 pm

An interesting difference between OS's. In RISC OS tasks are mapped into the address space begining at 0x8000 when the task is running, and thus have an entry point of 0x8000, even an AIF (the first word of an AIF is executable, even though part of the header). This makes some things very easy, because an OS kernel is loaded at 0x8000, same address, on most ARM based systems.

Kind of makes a person wonder, beings as RISC OS came first to the ARM, did early alternative OS's just start the kernel like any other program from RISC OS then take controll of the system? It is possible thanks to the OS_EnterOS system call (that puts the processor into SVC mode, and runs the following code in SVC mode).

Though in RISC OS it is actually possible to dispose of the linker script altogether when writing an OS kernel, not in most other OS's.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Thu Nov 22, 2018 5:52 pm

I hope that everyone is learning from my mistakes:
I made the same exact mistake all over again, with no good reason. Again I did not translate the naming of the script.ld linker script, and thus had the same exact problem building.

And there is no excuse. The simple BASIC program I am using would only require one entry added to an array of strings, and the extensions count variable increased by one, very simple to update and I still made the mistake.

I am glad I checked. I am going to provide sources for download in the standard form used by other OS's and include the BASIC program so that the filenames/paths can be correctly translated automatically for building in RISC OS.

Well I got RPCEmu running on ARMHF Linux on my RPi, so it is time to shutdown Linux, put back in the RISC OS SD, and get some real play done :) .
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Fri Nov 23, 2018 1:44 am

Well I am definitely slowed down on the testing side of SMP. My Raspberry Pi 3B just died, and it is the only multicore RPi I had.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: WIP: A new learning Toy OS, for the RPi 3B.

Sun Nov 25, 2018 11:52 pm

Something unreleated just started me thinking about the possibility of going with bluetooth for the KB/Mouse/Joysticks. I think that more people would likely understand bluetooth than would USB. And it is taking longer than anticipated to write usable documentation on using USB with the DWC controller of the RPi (using it is not the issue, we have all gotten that one sorted, the issue is documenting it in a useful way).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Return to “Off topic discussion”