Code Monkey home page Code Monkey logo

Comments (5)

mntmn avatar mntmn commented on June 28, 2024 1

Structs on ARM are fixed in the meantime btw!

from interim.

wasamasa avatar wasamasa commented on June 28, 2024

I've figured out that the rpi2-build.sh script expects newlib in a location like on Debian, after patching it the resulting binaries grew a bit. Still a white screen. Debugging by setting the framebuffer color reveals that doing anything involving USPi avoids reaching the remaining code, so that's weird.

from interim.

wasamasa avatar wasamasa commented on June 28, 2024

I've figured out how to load Interim on a more recent QEMU than in the bundled scripts. Here's my writeup so far:

You'll need a recent QEMU for this with the raspi2 system. The
general command line for launching is:

qemu-system-arm -M raspi2 -m 1024 -kernel build/interim-arm.elf -serial stdio

Note that QEMU supports running the raw binary image (located at
build/kernel7.img), however it expects an entry point of 0x10000
instead of 0x8000 in devices/rpi2/arm.ld.

The built kernel will hang, to debug why you'll have to boot QEMU with
a gdb server:

qemu-system-arm -M raspi2 -m 1024 -kernel build/interim-arm.elf -gdb tcp::26000

Open a suitable gdb from the same toolchain as what you've compiled
the kernel with:

arm-none-eabi-gdb
(gdb) target remote localhost:26000
(gdb) symbol-file build/interim-arm.elf
(gdb) continue
(gdb) ^C
(gdb) bt

The backtrace suggests that hardware timers aren't working correctly.
The workaround for this is to replace the definition of uart_init
with the commented out version that uses busy-waiting for delays.
Starting the kernel then proceeds up to a white screen and prints out
messages successfully via UART until encountering the USPi exception
handler. Fixing this requires understanding the USPi library and how
it's used...

from interim.

wasamasa avatar wasamasa commented on June 28, 2024

I eventually got around these issues by upgrading the bundled rpi-boot library and playing with the compilation flags (for some bizarre reason changing the optimization settings allows you to boot further, possibly the fault of undefined behavior and related compiler optimizations removing such code). It appears that structs don't work on ARM at all:

sledge> (struct bar slot 1)
-- clib _write called:
[(struct bar slot 1)]
-- clib _write called:
EXPR: ((struct bar slot 1) . null)
-- clib _write called:
<- compiling 1: (struct bar slot 1)
-- clib _write called:
compiled 1
-- clib _write called:
bar
-- clib _write called:
bar
-- clib _write called:
[insert_symbol] bar entry at 0x11c53a0 (cell: 0x1007d24)
-- clib _write called:
~~ expr 1 res: 0x1007d24
-- clib _write called:
~> bar
nil
-- clib _write called:
sledge> (bar)
-- clib _write called:
[(bar)]
-- clib _write called:
EXPR: ((bar ) . null)
-- clib _write called:
<- compiling 1: (bar )
-- clib _write called:
<error: non-lambda/struct symbol bar in operator position>
-- clib _write called:
compiled 1
-- clib _write called:
[platform_eval] stopped at expression 1: '((bar ) . null)'
nil
sledge>

from interim.

wasamasa avatar wasamasa commented on June 28, 2024

Oh sure, I just haven't tested yet whether booting on the Raspberry Pi works.

from interim.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.