LdB
Posts: 772
Joined: Wed Dec 07, 2016 2:29 pm

Xinu release

Wed Aug 08, 2018 1:13 pm

I finished the conversion of Xinu for the Pi1,2,3 and getting it ready to publish but just dealing with a few last strange bits

One of which is does anyone know what the strange characters on the Xinu start screen are
Image

I am guessing it's some sort of terminal emulation code to draw ascii code that I need to make the screen understand

When I hit a command like usbinfo it displays correctly .. I think :-)
Image
Last edited by LdB on Wed Aug 08, 2018 1:20 pm, edited 1 time in total.

procount
Posts: 1149
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Xinu release

Wed Aug 08, 2018 1:15 pm

They are ANSI escape sequences, in this case used to change the colour of the following text.
See https://en.wikipedia.org/wiki/ANSI_escape_code
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

LdB
Posts: 772
Joined: Wed Dec 07, 2016 2:29 pm

Re: Xinu release

Wed Aug 08, 2018 5:45 pm

Cheers for that much better display after adding an escape sequence parser
Just documentation to do and all done.

Image

Image

LdB
Posts: 772
Joined: Wed Dec 07, 2016 2:29 pm

Re: Xinu release

Fri Aug 10, 2018 4:36 am

In cleaning up the Xinu code there is something that puzzles me with the LAN9512 code in that it generates a random MAC address.

I am querying if that is correct and it shouldn't just be using the MAC address returned from the pi mailbox property tag 0x00010003
I know that return will always be b8:27:eb:??:??:??

LizardLad_1
Posts: 63
Joined: Sat Jan 13, 2018 12:29 am

Re: Xinu release

Sat Aug 11, 2018 4:19 am

Are you going to release the code on GitHub or GitLab?

User avatar
Ultibo
Posts: 131
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Xinu release

Mon Aug 13, 2018 11:37 am

LizardLad_1 wrote:
Sat Aug 11, 2018 4:19 am
Are you going to release the code on GitHub or GitLab?
Maybe neither, it seems the original authors of Xinu already have.

http://reu.mscs.mu.edu/index.php/Upgrad ... berry_Pi_3
https://dl.acm.org/citation.cfm?id=3162 ... CM&coll=DL




.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

LdB
Posts: 772
Joined: Wed Dec 07, 2016 2:29 pm

Re: Xinu release

Mon Aug 13, 2018 6:13 pm

Someone hasn't been watching the discussion on the other thread with one of the publishers :-)

Yes I am going to put it up on Github. I am just finishing the port to ARCH64 which has meant going thru and putting uint32_t in critical positions and packing some structures which is time consuming.

My warning is the linked repository code isn't stable .. so if you want to dash ahead and use it I will give you the two big gotchas that will drive you crazy.

1.) This one will drive you nuts everytime you change code slightly and recompile and the code will crash. Write some more and it comes back to working. Basically anytime you change the size of the BSS you can have dramas.

The problem is in start.S with the fact the Stack Pointer must be align 8. If you look at the BSS clearing code and Stack Pointer set you will see the problem and then look at the context stacksetup code. There is a label called _end in the linker file which is aligned and use that instead and it will stabilize to be usable.

2.) The whole memory sizing by atags isn't working and so the heap etc can get crunched on different models. The proper solution is to use the Pi mailbox system on channel 8 and get the VC and ARM memory from them.

On the linked repository the upper address has actually been hard coded for a Pi3
https://github.com/rlatinovich/xinu/blo ... forminit.c

Code: Select all

platform.maxaddr = (void *)0x3EFFFFFC; /* Used only if atags are bad */
It just needs to be got from Pi mailbox system channel 8, tag 0x00010005 and add the two values returned (the first will be zero anyhow).

Here is the proper Xinu memory layout with how you get the values from the various calls/variables.

Code: Select all

/*=========================================================================
*
*   Specific for Raspberry Pi all models - Memory Layout (Not to scale)
*  1GB MAX OF PHYSICAL MEMORY AVAILABLE ON ALL MODELS. 1GB == 0x3FFFFFFF

* +----------+
* |          |
* |  SPECIAL | -> BC2836/7 Multicore support area 0x40000000- 0x4003FFFF described in (QA7_rev3.4.pdf)
* |          |
* +----------+
      ....
* +----------+
* |	      |
* | IO SPACE | -> Pi1: 0x20000000 to 0x20FFFFFF, Pi2/3: 0x3F000000 to 0x3FFFFFFF 
* |          |    reserved for IO (GPIO, UART, SYS TIMER, USB CORE)
* +----------+
* |          |
* |  UNUSED  | -> Possible unused space on Pi1 with 256K, Pi2/3 with 512K memory
* |          |
* +----------+   <---- You get this from Pi mailbox system channel 8, tag 0x00010006 add the two values
* |          |
* |   GPU    | -> GPU will reserve 80-300K memory always at back of available memory
* |          |
* +----------+   <---- You get this from Pi mailbox system channel 8, tag 0x00010006
* |          |
* | UNUSED?  | -> Never seen but possible based on Pi mailbox system channel 8, tag 0x00010005, 0x00010006
* |          |
* +----------+   <---- You get this from Pi mailbox system channel 8, tag 0x00010005 add the two values
* |          |
* |          |
* |   HEAP   | -> getmem allocates from here
* |          |
* |          |
* +----------+
* |          |
* | OS STACK | -> becomes the null process stack of core(s) (size is set by NULLSTK in start.S)
* |          |
* +----------+   <---- _end label from linker file points here
* |          |
* |   BSS    | -> needed for C environment
* |          |
* +----------+
* |          |
* |   DATA   | -> XINU data variables
* |          |
* +----------+   <---- _etext label from linker file points here
* |          |
* |  RODATA  | -> XINU code constants
* |          |
* +----------+
* |          |
* |   TEXT   | -> XINU code
* |          |
* +----------+	  <---- _start address 0x8000 code kicks from here
* |          |
* | RESERVED | -> interrupt handler and vectors go here
* |          |
* +----------+ -> Address 0
*/

LizardLad_1
Posts: 63
Joined: Sat Jan 13, 2018 12:29 am

Re: Xinu release

Tue Aug 14, 2018 11:44 pm

I was really looking for a way to setup interrupts in AARCH64. I would imagine that xinu had interrupts working so I thought I could take a look at the code and see how it was done. I attempted it based of bzt's debugger however when I trigger brk #0 it jumps to the wrong address. I would be very grateful if some of you could take a look at the thread. In the meantime is it possible I could see the way that xinu sets up interrupt requests in AARCH64?

LdB
Posts: 772
Joined: Wed Dec 07, 2016 2:29 pm

Re: Xinu release

Wed Aug 15, 2018 1:46 am

Now just checking if you are talking about debugging EL1 user mode code I can help. If you are talking about EL2 or EL3 hypervisor debugging I can't never played with it. So assuming user code continue on.

ARM64 hardware timer interrupt code already exists on my repo in the standard blinker example
https://github.com/LdB-ECM/Raspberry-Pi ... /myBlinker

Stick the kernel8.img file from here on your SD card and it will show you it working
https://github.com/LdB-ECM/Raspberry-Pi ... er/DiskImg

The specific code for the handler is called "irq_handler" in
https://github.com/LdB-ECM/Raspberry-Pi ... tStart64.S

It's the stock standard nested handler from the ARM site (the link is in the code) saving all registers BUT not FPU. If you use the FPU in your interrupt code you will need to save them. If you know what registers you trash in the interrupt you can cut back the register saves making the irq faster.

It occurs to me with a timer polling debugger it may be easier to set the debugger up on one core and debug the code on another core.

I also discussed and provided code to handle core timer interrupts on a core other than 0
viewtopic.php?t=214006
I have code on repo as well
https://github.com/LdB-ECM/Raspberry-Pi ... 3Interrupt

You must have setup the core before you start handling interrupts by my smartstart code has always done that :-)
Last edited by LdB on Wed Aug 15, 2018 8:11 am, edited 1 time in total.

LizardLad_1
Posts: 63
Joined: Sat Jan 13, 2018 12:29 am

Re: Xinu release

Wed Aug 15, 2018 3:52 am

Sorry for contaminating the thread but yes it is in EL1. I have started a thread called bzt's debugger if you are able to help. I tried .balign instead of .align but that didn't help either.

LdB
Posts: 772
Joined: Wed Dec 07, 2016 2:29 pm

Re: Xinu release

Wed Aug 15, 2018 7:12 am

Sure no problems .. Do you have a git repo and I can look at fixing and where is the other thread?

Just made sure my repo was slightly more updated for you if you need to play.
I fully setup the core3 processing interrupt example.
https://github.com/LdB-ECM/Raspberry-Pi ... 3Interrupt

LizardLad_1
Posts: 63
Joined: Sat Jan 13, 2018 12:29 am

Re: Xinu release

Wed Aug 15, 2018 8:52 am

Hi LdB,

Here is the link to my GitHub repo: https://github.com/OllieLollie1/Raspi3-Kernel
Here is the thread: viewtopic.php?f=72&t=219693

Some information regarding the error is in the forum thread.

Return to “Bare metal, Assembly language”

Who is online

Users browsing this forum: No registered users and 5 guests