Time to switch to a more “simple” language: COW - Programming for Bovines
Some Driver Errors Maybe?
C:/Users/.../coding/other/astralixiOS/drivers/southbridge.h:38:10: note: previous declaration of 'sb_read_keyboard' with type 'uint16_t(void)' {aka 'short unsigned int(void)'}
38 | uint16_t sb_read_keyboard(void);
| ^~~~~~~~~~~~~~~~
[30/309] Building C object CMakeFiles/astralixi-os.dir/drivers/fat32.c.obj
ninja: build stopped: subcommand failed.
At least, can you tell me how the drivers work, and how I should initialize them?
Because I don’t know if printf statements are compatible with your drivers, because of the lack of documentation (sorry). I do respect the hard work you put into making these drivers, but I just have lots of unanswered questions.
For example, I don’t know if the OS will work, if I have only initialized the keyboard and display drivers, like do I need the southbridge, etc, initialized, or what?
I’ve made basic commands for the reading a writing files, thanks to your fat32 system, but do I need to do any initializations of the fat32 system other than the header file inclusions.
I do, respect your work, but I have unanswered questions, which I would like some answers and stuff for.
maybe you could start by answering questions that have been posed to you first? just a thought
Have you tried the hello world example posted in Blair’s README?
And to reiterate my earlier comments, you can’t make a big project like this in one go, especially while also learning a new language. You have to start small, just print some text to the screen, then you can ask for some input and print that too, and so on. Keep adding very small steps and testing every iteration
Nobody can debug hundreds of lines of code they don’t understand, by only making small changes to a system you know works you keep the errors manageable and easily fixable.
The thing which you are getting wrong there, is that I UNDERSTAND my code, and I have been programming with C for over 6 months now.
give me a question, and I will think about answering it.
And what you clearly still don’t understand, that is we can’t help you with the little information you’ve given us.
We’ve already told you: first you present your code, and THEN you can ask for review and help.
With that kind of lame response, you can be sure you’ll get help…
If you want answers, show us the material, the code. Or just stop crying everyday for help you don’t deserve, which is also fine.
In fact, you’ve annoyed me so much with your behaviour that even if you showed us your code tomorrow, I wouldn’t even want to help you now.
308 messages to be as vague as the first message. Half of which you whine about mistakes you don’t understand, but you ignore the answers when asked for more details…
Stop wasting our time with your whims. Follow the instructions or just turn it off.
Hi friends!
Is this thread for real? Or is it some kind of social experiment?
I read the whole thing, and at times it feels like a test to see how far the reader’s patience can be pushed. ![]()
Clearly, I’m getting too old for some things.
Cheers.
—-
Hola amigos!
¿Este hilo es real? ¿O es alguna clase de experimento social?
Lo he leído completo, y hay momentos en que creo que se trata de una prueba para ver hasta donde llega la paciencia del lector : )
Claramente, me estoy volviendo demasiado viejo para algunas cosas.
Saludos.
It’s real. And in a strange way it’s both fascinating and depressing.
On the one hand, I don’t think I’ve ever seen someone so interested and driven toward getting “answers”, but who also seemingly has no desire to actually learn or put effort into learning, especially avoiding learning by doing (as in working on smaller coding projects, making mistakes, building up from something simple to something more complex, etc.) As another “old” person in the thread, at first I thought it was just a combination of rudeness and laziness. But I’ve started to realize that it may simply be how the world has changed over time, and that Astrox (and presumably others out there) were never actually taught what they needed to be able to understand how to go about learning. Or maybe how to go about setting up achiveable goals? It seems that value can somehow only be seen in getting to the end result, in some twisted view of “ownership”, and in perceived “performance” (like “progress reports”, posts, and video logs that are somehow impressively devoid of useful information). But there doesn’t seem to be any recognition of value or interest in trying to understand, or interest in the learning process itself. And, when help is offered, or relevant information provided, there is almost zero gratitude in response.
Maybe I’m giving them more benefit of the doubt than they deserve, and Astrox has certainly been rude, but I’m not sure the blame is solely on them. I kind of think the system, sadly, has failed them. And I honestly don’t know what can be said on the forums here, or anywhere really, to help. In a weird way I also kind of admire Astrox. I’m not so sure I’d have been as determined to pursue my project after all these… setbacks. Clearly they’ve devoted some time and energy to this pursuit, and they haven’t given up, which is commendable. But at the same time it’s a shame their time and energy wasn’t put to better use, like actually trying to get a better foundation in software development and an understanding of embedded development, the Pico environment, etc. Just working on lots of smaller programs and projects and building up to something larger over time would have helped. There are plenty of subject matter experts here, and other helpful folks, but they can’t do the learning for someone else. That’s just not how learning works.
It’s also kind of ironic that @jblanked is on this forum (sorry for pulling you into this mess of a thread!) Since, in many ways, his Picoware project is almost the exact opposite of Astralixi OS. Again, I apologize for using your work as an example, but I think it applies (as a positive example) here. Not only is it open source, but it is also clearly a learning exercise. It’s not really my place to say, but I think that approach is exactly the sort of positive and successful example that Astrox could learn from, if they wanted to. (And by that I don’t mean “steal” the Picoware code! If anything, “steal” the learning process and take things one step at a time, pursuing your interests, and setting achiveable goals with the intention of eventually building up to an OS, or whatever it is that you want to build!)
Again, sorry for being weird for using yourself and project as an example, but I even think the interactions you’ve had on the forum here are essentially the opposite of Astrox’s. Both of you came in with passion about your projects, but in the case of Picoware, you showed it existed and already worked on similar platforms, you shared your (seemingly achievable) plans, you asked informed questions, shared relevant info, and you have had real (and respectful) conversations on the forum that increased your credibility here. In short, you’ve contributed as much as you’ve asked of the forum. This thread, and the other related threads and discord posts have kind of been the opposite experience regarding Astralixi.
Sorry for the long post. Hopefully this didn’t make a weird thread even weirder.
Six months? Sorry, but I seem to remember a post from you not that long ago asking how C pointers worked. Kid, some of us have been programing in various languages, at various levels, for years if not decades… I’m an old fart who’s been programming since I was a kid in the mid 1970’s. The community has demonstrated it’s eagerness to help, and all you’re doing is being purposely obtuse. You can’t expect definitive answers from vague information. So please, if you want to take advantage of help from a group of knowledgeable and experienced people, then take their advice and show some actual code. Otherwise, you’re more then welcome to figure it out by yourself… I first learned by digging program listing out of the trash and figuring out what the code was doing. We’ve got Github today, so there’s a massive amount of material you can learn from, and not just how to cut-and-paste.
it’s not even 3 months since this OS became a C project instead of mmbasic
and picocalc was released 5.5 months ago
Thanks for the tag and kind words @adcockm that means a lot coming from you man. I’m glad to be deemed a positive influence. It’s certainly not an “easy” learning experience, but it has been fun and a lot of developers (like yourself, Blair, pelrun, and a few others) have made developing for the PicoCalc much much easier.
@Astrox, I know many have said it, but just be willing to learn. I have checked out this forum and in my opinion, I think you’re just young (and that’s good because you have more time to learn than the rest of us). 6 months developing is great, but C/C++ and CMakeLists is a lot (even for myself with almost 6 years now of C++ and a year in C). It’s better to be humble and willing to share. That will help you grow your skill(s) faster in all aspects of life.
I don’t mean this to be rude, but it doesn’t seem like your code is “ground breaking”. In other words, sharing your code is not going to mess up your release. If anything, it’ll help you reach your goals for your firmware faster. Since you’re in the beginning stages of your project, most of what you’re trying to do is already out there.
Blair has been a huge help (including with your firmware already). Your issues with Blair’s drivers has something to do with your code. I use those exact drivers inside of Picoware. Like adcock mentioned, take a look at the Picoware source code (or Blair’s examples/my Youtube development series) to understand how to implement them into your project.
I bet if you open sourced your project right now, share it in this thread, and then ask for help, you’ll get positive feedback on what to do.
For example:
I’ve made basic commands for the reading a writing files, thanks to your fat32 system, but do I need to do any initializations of the fat32 system other than the header file inclusions.
You need to call fat32_init() and every time you read/write to a file use fat32_open and close when you’re done with fat32_close.
For example, I don’t know if the OS will work, if I have only initialized the keyboard and display drivers, like do I need the southbridge, etc, initialized, or what?
That depends on what you want to do in your project. You likely don’t need the display or picocalc drivers as to my knowledge they’re used for Blair’s example (main.c) as a way to track keyboard inputs. If you’re using the keyboard driver, southbridge will be initialized when you call keyboard_init
And with this:
C:/Users/.../coding/other/astralixiOS/drivers/southbridge.h:38:10: note: previous declaration of 'sb_read_keyboard' with type 'uint16_t(void)' {aka 'short unsigned int(void)'} 38 | uint16_t sb_read_keyboard(void);
You must’ve defined uint16_t sb_read_keyboard(void); somewhere else or removed the pragma once from southbridge.h
Best of luck. If you take this positively and open source your code, Astralixi OS will be ready in no time.
Astralixi OS Code, Open Sourced (kinda)
So, I sent this code to Blair yesterday, and because of all this, I guess I am going to send the stripped down version here too, it’s not much use, if anyone wanted to steal it. I just want clear feedback. ![]()
// Astralixi OS Code (stripped down version)
// Original Code: 500+ Lines
// Stripped Down Code: ~250 Lines
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <malloc.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include "lwip/netif.h"
#include "lwip/ip4_addr.h"
#include "drivers/display.h"
#include "drivers/lcd.h"
#include "drivers/keyboard.h"
#include "drivers/sdcard.h"
#include "drivers/audio.h"
#include "drivers/fat32.h"
#include "drivers/southbridge.h"
// REMOVED SOME PART HERE
bool sb_available(void) {
return keyboard_key_available();
}
uint8_t sb_read_keyboard(void) {
if (keyboard_key_available()) {
return (uint8_t)keyboard_get_key();
}
return 0;
}
void sb_init(void) {}
// REMOVED SOME PART HERE
int putchar(int c) {
if (c == '\n') {
display_emit('\r');
display_emit('\n');
} else {
display_emit((char)c);
}
return c;
}
int getchar(void) {
return (int)keyboard_get_key();
}
void read_line(char *buffer, int maxLength) {
int idx = 0;
while (idx < maxLength - 1) {
char c = keyboard_get_key();
if (c == '\r' || c == '\n') break;
if (c == 0x7F || c == 0x08) {
if (idx > 0) {
idx--;
display_emit('\b');
display_emit(' ');
display_emit('\b');
}
continue;
}
buffer[idx++] = c;
display_emit(c);
}
buffer[idx] = '\0';
display_emit('\n');
}
void safe_gets(char *buffer, int maxLength) {
read_line(buffer, maxLength);
}
//////////////////////////////////////////////
// ==== COMMANDS AND KERNEL CODE ==== //
//////////////////////////////////////////////
void command_hello(void) {
printf("Hello, %s\n", currentUsername);
}
// Displays exit message (actual exit is handled in main loop)
void command_exit(void) {
printf("Exiting...\n");
}
void command_help(void) {
printf("Available commands: hello, exit, help, whoami, passwd, time, settime, uname, cls\n");
}
void command_listfiles(void) {
// REMOVED SOME PART HERE
}
void command_createfile(const char *fullCommand) {
// REMOVED SOME PART HERE
}
void command_deletefile(const char *fullCommand) {
// REMOVED SOME PART HERE
}
void command_createdir(const char *fullCommand) {
// REMOVED SOME PART HERE
}
void command_deletedir(const char *fullCommand) {
// REMOVED SOME PART HERE
}
void command_printdirectory(void) {
// REMOVED SOME PART HERE
}
void command_changedirectory(const char *fullCommand) {
// REMOVED SOME PART HERE
}
void command_whoami(void) {
// REMOVED SOME PART HERE
}
void command_pico(void) {
printf("Raspberry Pi Pico 2W (RP2350) specs: \n\n");
printf("CPU: Dual-core Arm Cortex-M33 / RISC-V Hazard3 @ 150 MHz\n");
printf("RAM: 520 KB SRAM\n");
printf("Flash: 4 MB QSPI external flash\n");
printf("Wireless: 2.4 GHz 802.11n Wi-Fi (CYW43439), Bluetooth 5.2\n");
printf("GPIO and Interfaces: 26 GPIO (4 ADC), 2xUART/SPI/I²C, 24 PWM, 12 PIO\n");
printf("Power: 1.8-5.5V input, buck-boost SMPS\n");
printf("USB: USB 1.1 device/host\n");
printf("Size/Form Factor: 51x21mm, 40-pin header, SWD\n");
}
void command_cls(void) {
lcd_clear_screen();
lcd_set_background(RGB(0, 0, 0));
lcd_set_foreground(RGB(255, 255, 255));
}
void command_passwd(void) {
// REMOVED SOME PART HERE
}
void command_usernm(void) {
// REMOVED SOME PART HERE
}
void command_time(void) {
// REMOVED SOME PART HERE
}
void command_settime(void) {
// REMOVED SOME PART HERE
}
void command_uname(void) {
printf("Astralixi Kernel\n");
}
void command_memory(void) {
// REMOVED SOME PART HERE
}
void command_echo(const char *fullCommand) {
// REMOVED SOME PART HERE
}
void command_open_and_read_file(const char* filename) {
// REMOVED SOME PART HERE
}
void execute_command(const char *command) {
if (strcmp(command, "hello") == 0) {
command_hello();
} else if (strcmp(command, "exit") == 0) {
command_exit();
// REMOVED SOME PART HERE
} else {
printf("Command Not Found.\n");
}
}
void kernel() {
display_init(NULL, NULL);
keyboard_init(NULL);
sleep_ms(500);
// REMOVED SOME PART HERE
}
int main() {
kernel();
sleep_ms(500);
lcd_clear_screen();
lcd_set_background(RGB(0, 0, 0));
lcd_set_foreground(RGB(255, 255, 255));
printf("Astralixi OS Booting on PicoCalc...\n");
printf("Welcome to Astralixi OS!\n");
printf("--------------------------\n\n");
sleep_ms(1000);
Login_Sequence:
printf("Username: ");
read_line(enteredUsername, MAX_USERNAME_LENGTH);
printf("Password: ");
read_line(enteredPassword, MAX_PASSWORD_LENGTH);
sleep_ms(500);
failedLoginAttempts++;
if (strcmp(enteredUsername, currentUsername) == 0 &&
strcmp(enteredPassword, currentPassword) == 0) {
printf("Login Successful!\n");
} else {
printf("Incorrect Login!\n");
sleep_ms(1000);
if (failedLoginAttempts < 5) {
goto Login_Sequence;
} else {
printf("Too many login attempts!\n");
sleep_ms(1000);
return 0;
}
}
sd_init();
sd_error_t err = sd_card_init();
if (err != SD_OK) {
printf("SD init failed: %s\n", sd_error_string(err));
} else {
printf("SD card initialized successfully.\n");
}
sleep_ms(250);
audio_init();
fat32_init();
sleep_ms(250);
while (1) {
printf("> ");
// REMOVED SOME PART HERE
}
return 0;
}
This is a good start!
bool sb_available(void) {
return keyboard_key_available();
}
uint8_t sb_read_keyboard(void) {
if (keyboard_key_available()) {
return (uint8_t)keyboard_get_key();
}
return 0;
}
void sb_init(void) {}
Those are already defined in drivers/southbridge.h so you’ll get the previous declaration issue if you define them again.
What errors are you getting with that specific code reference you sent?
Other than that, try separating some of the functions into other files for easier organization. Create a GitHub account (if you don’t already).
So, I wasn’t occuring any errors, the issue which I was occuring, was when I flashed my OS to my PicoCalc, it just showed a blinking “_” cursor, and nothing else, which was odd.
That’s because of
The display_init() (and display driver) does that. You don’t need that in your project unless you’re building a command line only system. If you are building a command line only system, you should use his picocalc driver instead:
The init sets the driver (just like yours) but Blair also tracks keyboard input and display it on the screen.
Thanks @jblanked , @adcockm and the others for helping pushing him forward!
Using picocalc_init() function should be better to use indeed.
The main function lack the original sb_init() function (who probably cause invalid keyboard/backlight handling and causing the drivers to crash someway).
Seem that some of that function have been overriden at the start of the file. (sb_init, sb_available and sb_read_keyboard).
@Astrox You don’t need to rewrite them in your main.c because they are already present in southbridge.c. To be more specific, sb_init() is mandatory to initialize the I2C interface, which is required to operate the keyboard (and set the backlight of the screen/keyboard too).
The picocalc_init() function is a great exemple of what to call in the order to initialize everythings. You should use it directly to avoid any surprise.
Ok this might be a stupid question…
Do I have to initialize anything other than picocalc driver for my CLI system?