Tomrs123 wrote: ↑Tue Aug 20, 2024 2:24 pm
Okay, I'm doing the cross compiler using crosstool-ng, but I found this option:
cflags_crosstool_ng.png
Should I add the "-Wall -Wextra -Werror" flags to that?
EDIT: im just going to put them in the build script.
I would recommend always to do -Wpendantic or -Wall etc. (enable _all_ warnings) and try to ensure your compilation has no warnings at all. Usually they are there for good reason. There are rare cases that it's needed to do stuff that yields a warning, but I've not encountered any yet with my kernel stuff (I am also not so far yet...

).
-Werror might be a bit annoying as it will translate warnings to errors and really not let stuff build if there's a warning. It's maybe hardcore mode. Usually i try to get stuff working, and then get rid of all the warnings.
As for a cross-compiler. If you have any issues still after that, I'd recommend doing to full build of binutils + GCC as per the wiki. It takes a little time to build. Using the -j<num_processors+1> option can speed it up drastically. The instructions on the wiki are relatively easy to follow, and will help also learn a bit about building large software packages (and maybe hint towards how you want to create your own build system for your OS using makefiles.)
To test the IDT, i'd recommend using a CPU exception, for example the DEBUG exception. It's also nice to make a handler for that to actually print some debug info, like register contents etc. - that way you have a nice test, but also a good way to print out debug info when you need it.
The idt_test now seems to test the first IRQ (32?). If that is used by your devices it might cause some issues.
Lastly it might also be nice to use a stub-handler for IRQ's and ISR's so you can do the sending of EOI etc. there, and call a function from within that handler appropriate for the IRQ or ISR number. That way you don't have to duplicate that general handling code to all your handlers, and will have no chance you forget such things after it's all working.