alberinfo wrote:
in the repo are the .bin and .o files 'cause i want to have an apart dir to have the .o and bin files, and if you see a 'obin' directory you probably won't know what's the reason of it, so you can enter and see whats in
Oh, I get that, I think, but my point is that while you might want a directory for them on the individual development hosts, you usually wouldn't want the
Object Files themselves in the online hosted repo - they just take up space on the cloud host, and increase the download bandwidth for anyone else who is
cloning or
forking the repo.
Git itself has a way of handling this, with a hidden resource file called '
.gitignore'. This lets you update the Git repo while omitting certain files or file types that are in the repo's directory structure, but which don't need to be bundled into the repo package itself (because they are redundant, are automatically generated by the build system, only apply to the local system, or anything else like that).
The official documentation for this is
on the Git website. You might want to read
this James Coyle tutorial which explains this in greater depth. Note that this is a function of Git, not of the GitHub host, so it would work for any other host using Git; other Source Control tools such as Subversion or Mercurial have their own ways of getting the same results.
I don't know how well you know Git and GitHub, so you might want to look at
this tutorial if you don't know it all that well yet, as well as more of the
Atlassian Git tutorial I've already linked to.
The practical upshot of this is that if you add a
.gitignore file to the top directory of your
Slidoor-OS repo, with the following directives, it should omit the object files, libraries (the *.a files, which are basically just a collection of several *.o files bundled together, the *.so are similar, but are used for share libraries, something your OS presumably doesn't support yet) as well as things like backup files and other non-essentials:
Code:
# build-generated binaries
*.o
*.elf
*.a
*.so
*.d
*.bin
/bin
*.iso
# linker-generated data files
*.map
# various types of backup files
*.*~
%*%
*.bak
# log files and directories
/log
*.log
This will leave these files in your local host's file structure, but omit them from the uploaded files whenever you
push to the cloud host. A more extensive 'default'
.gitignore for C development in general can be found
here, though you need to keep in mind that this is only an example file - you can, and probably should, modify it to suit your own needs.
I don't know if you have a specific need to include the
/obin directory itself, or its contents, or the .iso file for the disk image, but if you don't, you can do this so that they don't take up space on the cloud-hosted repo.
alberinfo wrote:
when i compile the code, ld gives: undefined reference to '__assert_fail'
it's a problem from the assert function, but the assert.h is included
On the one hand, I was using that to test the code; you should be able to remove the asserts without any problems.
OTOH, it would make sense to address the problem itself, which is that you don't have a library with the assert function in it. See the wiki page
Creating a C Library for details about how to fix this.
Which brings up another issue with your header files: some of the functions are in the header files, including the
bcdtoint() function. this is an extremely poor idea. The wiki has
a page which explains the reasons for this in depth, but the important thing here is that (with the exceptions of inlined functions, macros, and in C++, templates) functions should be in a separate source file, which can be compiled to linkable object files, with only the function prototype in the header.
The
Object Files are, of course, the compiled results of the individual compiled source; these are what the linker works on to build the final executable binary, and the object files are usually in a variant of the
Executable Format used for that executable. But this is all 'you should know this already' stuff, so I don't want to insult your intelligence by belaboring it.
I will mention that you generally don't want to
#include headers inside of other headers, and you should put
header guards around the body of the header to prevent repeated inclusions (which can cause 'multiple definition' errors).
On a slightly related note: don't name the entry point to your kernel
main(). the
main() function has a very specific use in C, with a specific set of allowable function signatures, and using the name
main() for anything else tends to break a lot of things. You probably want to use a name such as
kmain() or something. I'm frankly surprised it compiled at all as it is - if you were using the recommended
warnings, such
-Wall and
-Wextra, in your
command line options (something I strongly recommend for
any GCC builds), it would have flagged this.
I also recommend that instead of a hand-coded shell script, you use a
build automation tool such as
GNU Make,
CMake,
Ant,
Ninja,
Meson, or the like. Some are based on the
classic Unix make(1) tool, while others might use XML files or some forms of GUI tooling; the point is that they do a lot of this work for you, which ever one you choose, and don't depend on their being a BASH shell to run the script in (meaning they are more usable under, say, Windows).