Difference between revisions of "C SDK Tips and Tricks"
Line 7: | Line 7: | ||
Extract it wherever you want, though putting it in the home directory is easiest. | Extract it wherever you want, though putting it in the home directory is easiest. | ||
+ | http://i.imgur.com/efX1W2r.png | ||
+ | http://i.imgur.com/eozLrjp.png | ||
===Environment Variables=== | ===Environment Variables=== | ||
---- | ---- | ||
<nowiki>- Open your ~/.bashrc file. (It is a hidden file in your home directory, [Ctl + H] to make it visible) | <nowiki>- Open your ~/.bashrc file. (It is a hidden file in your home directory, [Ctl + H] to make it visible) | ||
</nowiki> | </nowiki> | ||
+ | http://i.imgur.com/9dNrmrX.png | ||
<nowiki>- Add these lines to the end of the document:</nowiki> | <nowiki>- Add these lines to the end of the document:</nowiki> | ||
export PATH=$PATH:~/CEdev/bin/ | export PATH=$PATH:~/CEdev/bin/ | ||
export CEDEV=~/CEdev/ | export CEDEV=~/CEdev/ | ||
+ | http://i.imgur.com/nS3NFWG.png | ||
<nowiki>- If you extracted CEdev to somewhere else other than your home, change the paths to that location. Keep in mind that CEDEV needs to point to the Cedev folder, and PATH needs to point to the CEdev/bin folder.</nowiki> | <nowiki>- If you extracted CEdev to somewhere else other than your home, change the paths to that location. Keep in mind that CEDEV needs to point to the Cedev folder, and PATH needs to point to the CEdev/bin folder.</nowiki> | ||
---- | ---- | ||
Line 36: | Line 40: | ||
You will want to add '''graphx fileioc keypadc''' to '''L :=''' to be able to use the libraries. | You will want to add '''graphx fileioc keypadc''' to '''L :=''' to be able to use the libraries. | ||
+ | |||
+ | http://i.imgur.com/XfNMfAi.png | ||
That is just about everything you need to know about the makefile | That is just about everything you need to know about the makefile | ||
Line 57: | Line 63: | ||
You may also want to add '''gfx_FillScreen(gfx_white);''' to color the screen white. | You may also want to add '''gfx_FillScreen(gfx_white);''' to color the screen white. | ||
+ | |||
+ | http://i.imgur.com/8Sxcpad.png | ||
Remember, you can edit it more to tailor to your own needs, but this is what I do. | Remember, you can edit it more to tailor to your own needs, but this is what I do. | ||
Line 68: | Line 76: | ||
Open a terminal and CD to your program's main directory. My command to cd is: | Open a terminal and CD to your program's main directory. My command to cd is: | ||
cd /CEdev/Programs/[program folder name]/ | cd /CEdev/Programs/[program folder name]/ | ||
+ | http://i.imgur.com/793PHYp.png | ||
You can also right click in the folder and hit ''open in terminal''. | You can also right click in the folder and hit ''open in terminal''. | ||
Now, once you are in the correct directory, run. | Now, once you are in the correct directory, run. | ||
wine /home/[username]/CEdev/bin/make.exe | wine /home/[username]/CEdev/bin/make.exe | ||
+ | http://i.imgur.com/We3Izhu.png | ||
If CEdev is not in your home directory, just change the path to that location | If CEdev is not in your home directory, just change the path to that location | ||
It should run, and if you look in '''/bin/''' you should see a '''*.8xp'''. | It should run, and if you look in '''/bin/''' you should see a '''*.8xp'''. | ||
+ | |||
+ | http://i.imgur.com/ECOQwjD.png | ||
Put that on a calculator or [https://github.com/CE-Programming/CEmu CEmu] with the [https://github.com/CE-Programming/libraries C libraries], and you are all set! | Put that on a calculator or [https://github.com/CE-Programming/CEmu CEmu] with the [https://github.com/CE-Programming/libraries C libraries], and you are all set! |
Revision as of 20:08, 27 August 2016
Setting up the SDK on linux
This section will help you set up the C SDK on linux. It is best to do it in this same order, but that is your choice.
Files
Download the C toolchain here.
Extract it wherever you want, though putting it in the home directory is easiest.
Environment Variables
- Open your ~/.bashrc file. (It is a hidden file in your home directory, [Ctl + H] to make it visible)
- Add these lines to the end of the document:
export PATH=$PATH:~/CEdev/bin/ export CEDEV=~/CEdev/
- If you extracted CEdev to somewhere else other than your home, change the paths to that location. Keep in mind that CEDEV needs to point to the Cedev folder, and PATH needs to point to the CEdev/bin folder.
Setting up the Template makefile
Once you have the Environment Variables set up, create a New folder where you will put all of your projects. (I put mine in CEdev/Programs)
Once you have that folder, go into CEdev/examples and copy template.
Paste the template in your programs folder.
Open it up and edit the makefile.
It should look something like this: http://pastebin.com/N7K4ppBD
Edit TARGET ?= DEMOT and replace DEMOT with your program name.
Keep DEBUGMODE ?= as NDEBUG until you decide to use the Debug features in your program.
The others are pretty self explanatory, and the comments at the top of the file will help with explanation.
You will want to add graphx fileioc keypadc to L := to be able to use the libraries.
That is just about everything you need to know about the makefile
Tweaking the main.c file
If you head into /src/ you will main.c. Go ahead and open it. It will look something like this: http://pastebin.com/QqEgTBid
If you make that file, it will not do anything. To make it easier to set up a new project, we will edit it.
To make anything work, we will have to include the libraries, add the following text underneath #include <string.h>
#include <graphx.h> #include <keypadc.h> #include <fileioc.h> #include <debug.h>
Next, uncomment PrgmCleanUp();
Then, add gfx_Begin( gfx_8bpp ); above that. This will make your program able to use the graphics libraries.
You may also want to add gfx_FillScreen(gfx_white); to color the screen white.
Remember, you can edit it more to tailor to your own needs, but this is what I do.
"Making" the program
Once you have edited and created your program, you will want to test it. To do so, you will have to "make" your program, and doing so will create a .8xp in /[program location/bin
Remember, this is on linux, and it will not work on windows.
Open a terminal and CD to your program's main directory. My command to cd is:
cd /CEdev/Programs/[program folder name]/
You can also right click in the folder and hit open in terminal.
Now, once you are in the correct directory, run.
wine /home/[username]/CEdev/bin/make.exe
If CEdev is not in your home directory, just change the path to that location
It should run, and if you look in /bin/ you should see a *.8xp.
Put that on a calculator or CEmu with the C libraries, and you are all set!
Setting up the SDK on Windows
This section will help you set up the C SDK on windows. It is best to do it in this same order, but that is your choice.
Files
Download the C toolchain here.
Extract it wherever you want, though putting it in the home directory is easiest.
Environment Variables
You can follow this tutorial.
A more in-depth process will come, once I get on windows again, or someone else fills it out.
Setting up the Template makefile
Once you have the Environment Variables set up, create a New folder where you will put all of your projects. (I put mine in CEdev/Programs/)
Once you have that folder, go into CEdev/examples/ and copy template.
Paste the template in your programs folder.
Open it up and edit the makefile.
It should look something like this: http://pastebin.com/N7K4ppBD
Edit TARGET ?= DEMOT and replace DEMOT with your program name.
Keep DEBUGMODE ?= as NDEBUG until you decide to use the Debug features in your program.
The others are pretty self explanatory, and the comments at the top of the file will help with explanation.
You will want to add graphx fileioc keypadc to L := to be able to use the libraries.
That is just about everything you need to know about the makefile
Tweaking the main.c file
If you head into /src/ you will main.c. Go ahead and open it. It will look something like this: http://pastebin.com/QqEgTBid
If you make that file, it will not do anything. To make it easier to set up a new project, we will edit it.
To make anything work, we will have to include the libraries, add the following text underneath #include <string.h>
#include <graphx.h> #include <keypadc.h> #include <fileioc.h> #include <debug.h>
Next, uncomment PrgmCleanUp();
Then, add gfx_Begin( gfx_8bpp ); above that. This will make your program able to use the graphics libraries.
You may also want to add gfx_FillScreen(gfx_white); to color the screen white.
Remember, you can edit it more to tailor to your own needs, but this is what I do.
"Making" the program
Once you have edited and created your program, you will want to test it. To do so, you will have to "make" your program, and doing so will create a .8xp in /[program location/bin/
Remember, this is on windows, and it will not work on linux.
Open a terminal and CD to your program's main directory. My command to cd is:
cd /CEdev/Programs/[program folder name]/
Now, once you are in the correct directory, run.
make
It should run, and if you look in /bin/ you will see a *.8xp.
Put that on a calculator or CEmu with the C libraries, and you are all set!