Activity

acetim100

Shipped this project!

Hours: 8.88
Cookies: 🍪 63
Multiplier: 7.04 cookies/hr

finished my driver!
this driver controls an oled display with the soul functionality of turining a gpio pin on/off

acetim100

OPTIMIZATIONS

added some optimiztions
regarding the delay to keep up with hardware frequency

and demo’ed the project
link to demo

TO BE CONTINUED!!

i am currently working with my friend to create a userspace library to interact with the oled display (draw in specific pixels, draw circles or maybe even a raycasting/raymarching renderer)

Attachment
0
acetim100

DEBUGGING, FIXING, AND MORE DEBUGGING!

after a long dubbiging session and a frustrating clash with the rust pr_info!() function (that will fucking corrupt your memory if you dont put a \n at the end)
i got the screen to work!
and by working i DO NOT mean only lighting up and showing random pixles- i mean i can write to the oleds misc device file and it will display it on the oled!
this is a demo vid of the display

so basically the driver is done but there are some optimizations to be done so next devlog will prb be the last before shipping

Attachment
1

Comments

BnaJns
BnaJns 12 days ago

flightreacts 🥹

acetim100

AHHHHHHH THE SCREEN IS ONNNN


the module has succesfully loaded to kernel and opened a misc device under /dev, now it has also sent the init sequence to turn on the screen!!!!!
(the screen shows random data because nothing has been written to it yet)

also i forgot to mention in the last devlog:


i implemented the write function that hooks write syscalls to the misc device and sends the data to my i2c handler to be written onto the screen (not tested yet but fully implemented)

Attachment
0
acetim100

kind of a stupid minor devlog

BUT I GOT THE MISC DEVICE UP AND RUNNING RAAAHHHH

GATEWAY TO USERLAND IS WIDE OPEN

Attachment
0
acetim100

INIT FUNCTION

so i finished writing the init function- most of the time spent since the last devlog wasnt on the function itself rather researching my oled display and its requirements
also i had to research how a communication sequence looks like for this specific oled, the communication itself happens over i2c but the specific detaild about how and when to send data differs from display to display,


Changelog

Attachment
0
acetim100

PROJECT UPDATE!

since the last devlog i had implemented the basic i2c interactions:

  • i2c start
  • i2c stop
  • write byte
    this paper was really helpful
    i have also set up a device file to let userspace processes interact with my driver.
    basically the driver “hooks” all write calls to that specific file in the /dev folder and passes the buffer to my driver (i also need to copy the buffer to kernel memeory) and then it writes to the screen.

the image below is the first basic 8 byte transfer that happnens when initialising an i2c connection.

Attachment
0
acetim100

FIRST GPIO INTERACTION

so, most of the progress i did was out-of-editor so time isnt really logged accuratly BUT:
i finally loaded my first kernel module that interacts successfully with the physical gpios

gpio 2 and 3 are on my default and i wrote a module to turn 2 off.
so gpio interaction is set up and ready to develop

also:

when using the rpipins tool (the one used in the image above) for mapping out all the gpio pins, i came across a bug that causes the app to crash so i lowkey fixed it and opened a pull request to merge my fix.

Attachment
0
acetim100

FINISHED DEVELOPMENT ENV SETUP!!

ok, so i had to do a lot of stuff before starting to work on the driver itself!

  • i had to recompile the raspberry pi linux kernel because it did not have rust support (i develop the driver in rust)
  • i also had to config my ide to recognise the kernel crate (which is not by default in crates.io) so i had to clone the tree locally
  • created a script to automate deployment (compilation - > copy module with scp to raspi-> ssh to raspi->remove previous module ->load new module)

loaded my first kernel module!!

the image attached is the kernel logs!!!
(ofc the output was through an ssh connection to the raspi)

Attachment
0
acetim100

Shipped this project!

Hours: 7.3
Cookies: 🍪 133
Multiplier: 18.22 cookies/hr

finnaly added AArch64 support (cross-compilation) for the shoresh language!

acetim100

FAAAAAHHHH

it is currently 5 am.
i spent 2 hours debugging this single fibbonacci program.
because im developing arm64 support for my compiler and my processor is x86_64- i have to use an emulator

the process of debugging through an emulator is pure toture

  • i have to run the emulator with a flag to make the program pause at start and be ready for gdb to attach at a specific port
  • then i need to run a cross debugger and set the architecture to arm64
  • then i need to connect to said port to start debugging the executable
    the problem was this :
    alt text

in my arm64 asm generator i accidentally swapped the w0 and w1 registers
w0 -is the right side of the expression
w1- is the left side of the expression
which i documented for myself at the head of this function:
d

so i was acc checking if w0<w1 (right<left)
instead of w1<w0 (left<right)
when checking “lower than” expression
(bug was also present in higher than expressions)

then it finally worked:

some other changes i made

fixed some other bugs i caught on static analysis relating to function prologues and epilogues

Attachment
0
acetim100

working on AArch64 support

  • finished arm64 code generation
  • currently testing it

ALSO: i had to learn arm for this, so its been a bit of time since the last devlog!

arm asm is way more annoying than the “regular” x86 architecture, all instructions are limited to 32 bits and with it comes challenges mainly revolving around immidiate value loading and other stuff like literal addresses

but! arm also has some pretty neat features like three operand instructions, meaning i can take 2 registers add them together and put the calculated value in another register- all in one instruction
this saved me a bit of lines of code but not that significant

some patches

  • removed annoying stderr message each time the compiler enters sync mode
Attachment
0
acetim100

Shipped this project!

Hours: 16.45
Cookies: 🍪 297
Multiplier: 18.03 cookies/hr

i built a compiler for my own language which is inspired by ancient biblical hebrew. the hardest part was debugging the generated asm file to ensure it works as intended -using gdb. during debugging i learned about the 16 byte stack alignment requierment that the libc funcs (and a lot of other libraries) go by. (it has smt to do with optimization). because i used 0 external libraries for this compiler i had to learn a lot about how compilers really work and implement eveything by myself which was really enjoyable

acetim100

FINAL DEVLOG(BEFORE SHIPPING)

shoc- now available on npm!!!
full documentation is available on the github repo in the link below, documentation contains guide on how you can install the compiler , how to use it & how to write in the language

what did i do since the last devlog?

i just finished testing and and fixing bugs in the assembly part and in the program itself
also added shabatchk function to the compiled asm- it checks if its sabbath today and if it is it will not run (no work is permitted on sabbath)
i also have a repo in my github account that contains the notepad++ config for the user defined language - it provides syntax highlighting for shoresh and a nice development env

planning do add:

i will add support for arm64 linux native asm a
and i will prb add arrays sometime soon

github repo

Attachment
0
acetim100

CODE GENERATION & I\O &BUG FIXES

fixed some bugs in semantic validation(concerning stack alignment in x64 architecture asm)

implemented some of the code generation(to x86_64 GAS intel syntax asm) functions (not all of them)
with the most important one being the AstExpression and made a recursive algorithm to traverse the AST tree and convert it to asm code
the algorithm itself isnt the most efficent because it uses the stack to store intermediate values during calculation and i will prb implement a register map to use the registers instead of the stack (until they are all in use ofc)

i also added io functions to let you input a number to a variable, a function that lets you print an expression and a function that lets you print a string

printing and input is handled by libc

Attachment
Attachment
0
acetim100

ADDED UNARY EXPRESSIONS AND FIXED SOME BUGS

i added the possibility to use unary expressions like -,! inside my expression parser
the image shown is a debugging functions output that prints out the structred nodes that define the program
the highlighted part is the not operator (לא in hebrew) being parsed correctry
the expression is printed in prefix notation or how some may call it - “polish notation”
i also fixed a bug in the typeCheker that caused the type checker to not check the validity of the expressions it passes to the function

Attachment
0