Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have some very specific questions about writing operating systems that I was hoping could get answered:
How much assembly code would I need to write to load a minimal C Kernel if I use GRUB as a boot loader?
My kernel will be written in C, It will load a command line shell that I wrote in C++, it does not make any API calls only standard library calls, will I need to rewrite the entire C++ Standard library to do so?
Can I write video, keyboard and floppy drivers in C++?
Do GCC and G++ output 16 bit real mode code?
Can I write this all using Mingw on Windows or will I have to write it on Linux?
Do I need to be in real mode in order to write directly to the video memory?
If anyone can answer my questions I will be very thankful
1: You should only need a small amount of assembly to handle the boot process and load the C code. Shouldn't be more than like 20-30 lines I think.
2-4: I haven't really used C++ with OS dev, but I think I remember reading that it takes more work to get it running somewhere. Sorry I can't be of more help.
5: You "can" do it using MinGW, but from my experience it mostly complicates things. I could never really get a Windows environment working, but I also gave up without too much effort.
EDIT: Here is a link to some example assembly. This is all I ever had to use:
http://www.jamesmolloy.co.uk/tutorial_html/2.-Genesis.html
The rest of that site is a pretty good tutorial too if you are at all interested in that kind of thing.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
After a lot of research i could not find any solution to my question (if i did i woudln't be here ...)
I'm looking for solutions that permits me to reduce the flash memory used by my program.
I'm programming an embedded c++ programm and when i Flash my electronic card in release mode everything is fine cause it doesn't overflow the space of the flash memory, but that is not the case when i do it in Debug mode... I want to know if it is possible to find functions (my goal is to do it without reducing the code) that could reduce Flash memory.I already thought about defragmentation but I don't find how to do it in embedded even though i don't even know if i can ... I also tried the -Os cmd from gcc but without any big success
So I'm taking any advices or support and i'll be there at any question about my issue ;)
Thanks !
Look at your map file. Is there something there you don't
expect? Functions you aren't expecting (like floating point, or
exception handling, etc.) or something unreasonably large?
Turn on optimization except for the file you're interested in.
Make sure you've actually got optimizations turned on (look at the build log and ensure that you've got -Os being passed to each compile step)
Consider link time optimizations, but don't expect miracles
Welcome to embedded programming. 90% of the job is figuring out how to stuff the never ending requirements into the memory available. Rinse and repeat.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Let's say we've got a first program called Program1.exe which contains the necessary information to create and compile another application called Program2.exe. Actually it could also load that information from a txt file or whatever.
Googling, I've found that this is "easy" to do in C#, using Visual Studio:
How to programatically build and compile another c# project from the current project
Programmatically Invoke the C# Compiler
The problem is that I'm not using (and can't use) C#, but C++. Summing it up, my question is if that I can do this same thing using C++.
I would prefer to do it without additional libraries, but if that's not possible, or if it's too hard to do, you can also recommend any library allowing it.
I think you'll probably have noticed it, but my goal is to use it under Windows so I don't care if it's not portable.
Thanks everybody.
It's trivial (if maybe a bit odd) for a C++ program to compile and run another based on code stored in a text file. Debugging that other program, however, isn't.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm currently doing research about memory checking tools for Windows 7, MS Visual Studio C++. For tools which are free, or have demo available, I would like to run special test: run a simple application which would contain as many different memory errors as possible so I could check how many of them the tool can detect.
So I would like to ask whether there is available source code in C++ for such application.
Notes:
I Googled this thing, but all I could find are questions and sites about memory checking tools.
Of course I could write such app (and I will do it if there is no such code available), but I know I will probably forget some kinds of errors. For example I even didn't think about checking whether memcpy's parameters are overlapping (which is an error - use memmove instead, or revise the code) until valgrind found it in my personal project (in this case, I copied an array into multiple places and I forgot (in a loop) to omit the first (source) array). I believe there is much more error types I never thought about.
I cannot use valgrind as it MUST be Windows MS Visual C++ application, I cannot change this decision, and valgrind under Wine looks like too complicated so I probably won't be able to convince my colleagues to use this solution. And it's not even sure that Wine will run our app...
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm writing a basic command line operating system for the raspberry pi, much like those on computers from the 70's and early 80's. I have made the basic text input / output with assembly and would like to incorporate a BASIC interpreter into my code. I was thinking of writing my own version of BASIC and an interpreter in C++/Java (maybe not, since it's compiled into bytecode) then compiling it into ARM assembly for the raspberry pi, is this possible?
P.S I considered writing it in assembly, but figured that would be too complicated for my abilities.
Yes, it's possible since once you have a C++ compiler for your taget platform. You can use any language you want/need to, including Java since once all needed tools to compile/interpret are available in the target platform. You can do in assembly too. But do you really need/want to? it's really a lot of job without no much fun.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am a beginner at programming, so this might be a dumb question, but here it is...
I've been going through books, learning languages such as C and C++, and I have a basic understanding of the code. Yet, is this type of code used in actual programs? For example, I open a program on my computer, and there is a nice looking user interface on it. When I code programs at home, my user interface is the command line. But when I go to code a program with a GUI, the code I learn in books doesn't even apply to the GUI code.
So I guess I'm wondering - How does the code and things you learn in books apply to actual programs with a user interface? And is the code used for console applications even used anymore?
Any guidance or help would be appreciated!
Thanks
Ian Vaughn
Yes and yes.
GUI's are sometimes programmed in C++ (C is rarer), but it's also used for console programs. One special type of GUI's is in fact usually done in C++, and that's games. A common example of console programs is a converter program, which takes in one file and creates another. It's UI can be ./tool < InFile > OutFile.