Page 3 of 4
Re: Languages for standalone
Posted: Mon Oct 26, 2020 6:04 am
by eekee
It is fun! You're welcome.
Re: Languages for standalone
Posted: Tue Nov 03, 2020 1:06 pm
by SamDengmar
C language doesn't need anything. All of its run-time is pushed into library functions.
Re: Languages for standalone
Posted: Tue Nov 10, 2020 7:35 pm
by Thomas
Re: Languages for standalone
Posted: Wed Nov 11, 2020 2:37 pm
by eekee
@Thomas: Nice! Am I making too big a leap in assuming this RISC processor is related to RISC-V?
Re: Languages for standalone
Posted: Thu Nov 12, 2020 6:24 am
by Thomas
Hi eekee,
http://www.projectoberon.com/
The oberon language is not tied to any implementation. Yes, the processor implemented on FPGA is based on Risc5. Dr Wirth designed pascal. It is no surprise than oberon has a pascal flavor.
--Thomas
Re: Languages for standalone
Posted: Thu Nov 12, 2020 9:34 am
by PeterX
eekee wrote:@Thomas: Nice! Am I making too big a leap in assuming this RISC processor is related to RISC-V?
Professor Wirth's Risc CPUs are not related to Risc-V.
Greetings
Peter
Re: Languages for standalone
Posted: Thu Nov 12, 2020 12:59 pm
by Thomas
The module is named RISC5. I did not dig deep to see if the implementation is actually based on RISCV. Sorry!. During my college years, there was only the native Oberon which ran on bare x86 hardware.
--Thomas
Re: Languages for standalone
Posted: Wed Nov 18, 2020 8:24 am
by eekee
Thanks guys.
I'm thinking I might write up a wiki page for Plain English Programming, but I'm awfully tired these days. Maybe when my meds are sorted.
SamDengmar wrote:C language doesn't need anything. All of its run-time is pushed into library functions.
This is almost but not literally true. C has a very small runtime; look up crt0. "crt" in fact stands for "C run-time".
Re: Languages for standalone
Posted: Wed Nov 18, 2020 12:20 pm
by eekee
bloodline wrote:eekee wrote:You know, I don't think Plain English Programming has much runtime. The package you get includes just 5 files of source, and that's sufficient to rebuild itself. To build other programs with it, you only need to include one of those files. In other words, the entire language runtime is in one file.
https://osmosianplainenglishprogramming.blog/
Goodness! This looks like a fun language, I’ve never heard of it before, thanks for sharing. I’ll have fun reading about this language later
I was in the mood to waste time today.
https://wiki.osdev.org/Plain_English_Programming
Re: Languages for standalone
Posted: Wed Nov 18, 2020 1:00 pm
by bzt
eekee wrote:SamDengmar wrote:C language doesn't need anything. All of its run-time is pushed into library functions.
This is almost but not literally true. C has a very small runtime; look up crt0. "crt" in fact stands for "C run-time".
...which is not used in freestanding mode.
It's perfectly valid not having "main()" in a C source and implement directly "_start()" instead (conventionally the executable's entry point is "_start", provided by the crt0 in hosted environment, which in turn calls "main").
Cheers,
bzt
Re: Languages for standalone
Posted: Wed Nov 18, 2020 2:31 pm
by eekee
So how do you set up the stack, then?
That's one of crt0's jobs.
Re: Languages for standalone
Posted: Wed Nov 18, 2020 5:44 pm
by nexos
eekee wrote:So how do you set up the stack, then?
That's one of crt0's jobs.
The program loader should set up a stack. crt0 would not allocate the stack, as crt0 needs a stack itself
.
Re: Languages for standalone
Posted: Wed Nov 18, 2020 6:30 pm
by eekee
Y'all are making me think!
Why would crt0 specifically need a stack when it's typically written in assembly language? It's fine for the program loader to provide one, but a bit of searching earlier indicated there are architectures where crt0 has to set up the stack.
Re: Languages for standalone
Posted: Thu Nov 19, 2020 10:15 am
by Solar
A freestanding platform might not have a program loader. Your program might be sitting on a ROM, with the CPU starting at a hard-coded address on power-up. BIOS, Kickstart, you name it.) Your platform might not have a stack. I don't know what other architecture it could have, but there is no mention of "stack" in the language standard; it's up to the implementation how it handles automatic variables and returning from functions. If you're thinking about what could be, don't get hung up on what "usually" is...
Re: Languages for standalone
Posted: Thu Nov 19, 2020 1:36 pm
by nexos
bzt was talking about in the case of a loaded program on say Linux. Although an insane kernel may not set up a stack, most kernels do set one up automatically. Systems without a stack will use something else in place. I'm thinking of x86
. As for BIOS ROM code, that's sort of different, as generally there called from the CPU. I was talking about the situation bzt was talking about. Also, crt0 doesn't need to set up a stack, because as Solar said, the C spec doesn't mention a stack in it.