5 ms·
I see your userland M1 assembly language hello world and raise you a bare-metal M1 kernel assembly language hello world :-) https://github.com/AsahiLinux/m1n1/
by marcan_42 6y ago
I see your userland M1 assembly language hello world and raise you a bare-metal M1 kernel assembly language hello world :-)
https://github.com/AsahiLinux/m1n1/blob/main/src/start.S https://github.com/AsahiLinux/m1n1/blob/main/src/start.S
The first few lines of that will print 'm1n1' to the serial port as it initializes other things and eventually jumps to C code.
- nneonneo 6y agoThis looks basically like assembly code for practically any embedded system - reading/writing hardware registers to interact with UARTs. Nice job (& best of luck with the Asahi Linux project - very exciting!)
- marcan_42 6y agoWell, the Apple M1 is an embedded SoC after all :) Thank you!
- yitchelle 6y agoThat is the most exciting part of the M1 for me. What do you think will be the first embedded application for the M1, assuming Apple allows it to be purchased by 3rd parties? Autonomous driving, or robotics, or other..??
- saagarjha 6y agoApple won't allow it to be purchased by third parties.
- magnusmundus 6y agoNot quite as exciting as your examples, but I guess an evolution of Apple CarPlay might be likely.
- WanderPanda 6y agoYes they need to capture the car UI part as legacy automakers will not be able to build an ecosystem for that.
- SftwreEngnr 6y agoPolitely, fuck off with the emoticons.
- DonHopkins 6y agoI can't reply directly to the totally useless and aggressive and self contradictory sibling message from rightfully banned user "SftwreEngnr", but if I saw a real Software Engineer writing code with abbreviations like "SftwreEngnr", I would fire them immediately. Nobody wants to remember your uniquely annoying special snowflake abbreviations, and try to guess and remember which letters you arbitrarily and capriciously decided to leave out just to save a few keystrokes of typing. Learn to touch type and spell out the entire words correctly without missing any letters, or find a different career, "SftwreEngnr".
- CyberRabbi 6y agoWhat baud rate does it run at?
- marcan_42 6y ago115200 by default (it's what iBoot initializes it at), but I spent a chunk of yesterday's live development stream yak-shaving a way to smoothly switch to 1.5Mbaud in a way that lets my Glasgow-based auto-baud-sensing serial interface resync cleanly (turns out: it seems to be impossible using any single byte repeating with 1 stopbit and no pauses due to ambiguous framing; I had to use a multiple-byte pattern).
- reaperducer 6y ago115200 by default This made me laugh because I spent a good chunk of last weekend trying to debug a problem with some of my old computer hardware and the problem turned out to be a link that couldn't handle anything over 150 baud. Now we're squirting 115,200 straight out of a chip. It's like the future!
- CyberRabbi 6y agoThe crazy part is that 115200 is actually slow by today’s standards!
- sneak 6y agoString bet! :) (Raises are not accepted after you've already called.)
- SulfurHexaFluri 6y agoHow do you actually load / run this code without an OS? I'm guessing its the same way something like grub gets run?
- deleted 6y ago[deleted]
- moonchild 6y agoI don't know how it works on apple hardware—though I heard they used a UEFI variant with HFS+ at one point—but in general, on PCs, there are two ways to get bootcode to run. The first is legacy BIOS: the BIOS will load the first 512 bytes of the boot sector, called the Master Boot Record (MBR) into memory location 0x7C00; they are then responsible for bootstrapping the rest of the system. Usually by doing the bare minimum to load a second-stage bootloader off the disc, and letting the second-stage bootloader do the rest of the work, since 512 bytes (actually only ~440) is really not very much. The second is UEFI. The firmware will load a PE-formatted executable from a .efi-suffixed file on a FAT32 partition which has the EFI System Partition (ESP) flag set. Since this PE file can be any size, a second-stage bootloader is not generally necessary (but may be interesting for aesthetic reasons e.g. if you don't like PE).
- alexjm 6y agoThe process for Apple hardware to find and start EFI is described in the "Booting from an Apple File System Partition" section on page 22 of this document. Basically, the EFI image is read from a special block on disk. https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf https://developer.apple.com/support/downloads/Apple-File-Sys... The boot process for HFS+ is more involved, because you have to actually read the HFS+ file system to locate the EFI image, since it's stored in a regular file. I'm not sure what happens after jumping into the EFI code. (Disclaimer: I worked on the linked document.)
- CameronNemo 6y agoOn Rockchip boards, there is a bootrom that looks for data at a specific offset on a few storage devices, then calls the first one it finds. From there open source / flashable firmware initializes RAM, scales up CPU frequencies, and starts looking for a kernel or whatever. TL;DR likely read only firmware, possibly more low level than a BIOS, UEFI, or Coreboot implementation would be. Edit: then again, they could be shipping a full EFI implementation like they do on their x86 offerings.
- user-the-name 6y agoWhere is the UART on that thing?
- terramex 6y agoUART can be enabled on M1 Mini on "the leftmost port (closest to the power input)". It first needs to be enabled by sending special USB-PD message. More information: https://github.com/AsahiLinux/docs/wiki/HW%3AUSB-PD https://github.com/AsahiLinux/docs/wiki/HW%3AUSB-PD
- user-the-name 6y agoInteresting!
- deaddodo 6y agoHe talks about it here: https://www.youtube.com/watch?v=d5s9fYfvzmY https://www.youtube.com/watch?v=d5s9fYfvzmY (In addition to the docs, as outlined by terramex)
- cshift 6y ago> I see your userland M1 assembly language hello world and raise you a bare-metal M1 kernel assembly language hello world :-) The most on-brand HN thing I've read so far today.
- RantyDave 6y agoLOL. Zephyr?