Questions tagged [freestanding]

A freestanding implementation of C/C++ is an implementation that can work without an operating system and has an implementation-defined set of libraries. Commonly found in embedded development environments.

The C++ standard defines hosted and freestanding implementations as follows (§1.4/7)

Two kinds of implementations are defined: a hosted implementation and a freestanding implementation. For a hosted implementation, this International Standard defines the set of available libraries. A freestanding implementation is one in which execution may take place without the benefit of an operating system, and has an implementation-defined set of libraries that includes certain language-support libraries (§17.6.1.3).

Use this tag to mark C/C++ questions (together with general and and optionally with tags for specific language standards, for example or ) where these constraints may apply.

Also, make sure the question explicitly states which libraries are and are not available (besides the minimal language support headers that are required).

References:

39 questions
0
votes
1 answer

undefined reference to `WinMain` while compiling my own kernel

I've started writing my very own kernel and am developing on Windows 10. I am using the following tools: gcc 8.1.0 elf x86_64 for compiling my C code, and for linking. I am using this Windows package. nasm 2.14.02 for compiling my assembly…
David Callanan
  • 5,601
  • 7
  • 63
  • 105
0
votes
0 answers

Custom Freestanding printf only displaying one letter and random capital S

I am trying to develop my own kernel which I am booting to with GRUB. In order to display strings with variables, I have started to develop my own printf(char*, ...) function. Here is the kernel.cpp (thanks to Write Your Own Operating System YouTube…
iProgram
  • 6,057
  • 9
  • 39
  • 80
0
votes
1 answer

Split char* at delimiter in freestanding mode c++

I am trying to write my own operating system. I have followed the tutorials on the OSDev Wiki, and I am now working on writing a console mode, with commands. I need to be able to split a char* into a char**, without all the library functionality…
JkyCosten
  • 23
  • 10
0
votes
2 answers

Making a function to choose an interface depending on arguments

I want to make a function to choose another one in C, maybe this C-pseudo code can help a little to clarify what I want: void set_method(const char *method) { // Check if the method is serial_port if (strcmp(method, "serial_port") == 0) …
Rottenheimer2
  • 425
  • 1
  • 5
  • 13
0
votes
0 answers

Printing letters with a set_pixel function (c)

I have a set_pixel function (a function that sets the color of a pixel in a example display), and I only have this method of output to print to a display. I was trying to print some characters to the screen for debugging and other general…
Rottenheimer2
  • 425
  • 1
  • 5
  • 13
0
votes
0 answers

Can GCC create position independent code for freestanding environments?

I have always thought that the generation of position independent code (PIC) basically only depended on the CPU one is compiling for. However, after reading this in the GCC documentation: For the 386, GCC supports PIC for System V but not for the…
elaforma
  • 652
  • 1
  • 9
  • 29
0
votes
1 answer

Deciding return type for variadic C++11 templated lambda function

I've got the following function; template void transform(void (*func)(Parameters...)) { auto lambda_function = [func](T args, U params) { …
Skeen
  • 4,614
  • 5
  • 41
  • 67
-1
votes
2 answers

uintx_t to const char* in freestanding c++ using GNU compiler

so I am trying to convert some integers in to character arrays that my terminal can write. so I can see the value of my codes calculations for debugging purposes when its running. as in if the int_t count = 57 I want the terminal to write 57. so…
skyline
  • 51
  • 9
-2
votes
2 answers

If something is a const volatile int, can it change based on the status of a variable?

I have a unsigned const volatile short int*. I want it to be (x + y), which at time of defining is set to 0. However, i want if for some reason y changes to 5, i would want the unsigned const volatile short int* to change too. Would this be possible…
180Five
  • 13
  • 5
1 2
3