OSDev.org
https://forum.osdev.org/

Languages for standalone
https://forum.osdev.org/viewtopic.php?f=13&t=37326
Page 3 of 4

Author:  eekee [ Mon Oct 26, 2020 6:04 am ]
Post subject:  Re: Languages for standalone

It is fun! You're welcome. :D

Author:  SamDengmar [ Tue Nov 03, 2020 1:06 pm ]
Post subject:  Re: Languages for standalone

C language doesn't need anything. All of its run-time is pushed into library functions. :^o :^o

Author:  Thomas [ Tue Nov 10, 2020 7:35 pm ]
Post subject:  Re: Languages for standalone

Hi,
Oberon
I presented this in college while doing a compiler project.

http://www.projectoberon.net/wirth/Proj ... System.pdf
http://blog.gadgetfactory.net/2016/02/h ... dern-fpga/

--Thomas

Author:  eekee [ Wed Nov 11, 2020 2:37 pm ]
Post subject:  Re: Languages for standalone

@Thomas: Nice! Am I making too big a leap in assuming this RISC processor is related to RISC-V?

Author:  Thomas [ Thu Nov 12, 2020 6:24 am ]
Post subject:  Re: Languages for standalone

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

Author:  PeterX [ Thu Nov 12, 2020 9:34 am ]
Post subject:  Re: Languages for standalone

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

Author:  Thomas [ Thu Nov 12, 2020 12:59 pm ]
Post subject:  Re: Languages for standalone

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

Author:  eekee [ Wed Nov 18, 2020 8:24 am ]
Post subject:  Re: Languages for standalone

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. :^o :^o

This is almost but not literally true. C has a very small runtime; look up crt0. "crt" in fact stands for "C run-time".

Author:  eekee [ Wed Nov 18, 2020 12:20 pm ]
Post subject:  Re: Languages for standalone

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 :D

I was in the mood to waste time today.
https://wiki.osdev.org/Plain_English_Programming :mrgreen:

Author:  bzt [ Wed Nov 18, 2020 1:00 pm ]
Post subject:  Re: Languages for standalone

eekee wrote:
SamDengmar wrote:
C language doesn't need anything. All of its run-time is pushed into library functions. :^o :^o
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

Author:  eekee [ Wed Nov 18, 2020 2:31 pm ]
Post subject:  Re: Languages for standalone

So how do you set up the stack, then? :) That's one of crt0's jobs.

Author:  nexos [ Wed Nov 18, 2020 5:44 pm ]
Post subject:  Re: Languages for standalone

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 :) .

Author:  eekee [ Wed Nov 18, 2020 6:30 pm ]
Post subject:  Re: Languages for standalone

Y'all are making me think! :P

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.

Author:  Solar [ Thu Nov 19, 2020 10:15 am ]
Post subject:  Re: Languages for standalone

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...

Author:  nexos [ Thu Nov 19, 2020 1:36 pm ]
Post subject:  Re: Languages for standalone

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.

Page 3 of 4 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/