Greetings Everyone,
I like to use the Code::Blocks IDE to write C programs but to write C programs for my TI-84 Plus CE I use the CE C Toolchain. I use the Toolchain as described in the documentation, edit the program using Notepad++ and then open a command window to invoke make.

Now, one of the things Code::Blocks was designed to do was to have new compilers added to it, which I have done in the past. So yesterday I got to thinking I wonder if I could add the CE C Toolchain to Code::Blocks and use it's editor and compile my source directly from there. I like challenges, so yesterday I sat down and figured out how to incorporate the CE C Toolchain into Code::Blocks. Turns out it really wasn't that hard to do.

I was wondering if anyone here would be interested in me outlining the process? It is a little involved so I didn't want to post it if no one is interested.

I really have not been paying much attention recently, but does anyone still write C programs for the TI-84 Plus CE? I know TI stopped support a few years ago, which is why I've never upgraded my calculators OS so I can still run assembly and C programs.
Plenty of people write C programs for the TI-84 Plus CE (i am one of them as of late). Also, although i will probably stick to vs code and its integrated terminal, i think it would be interesting (to me at least) to hear how you did that (because i am a n00b interested in learning).
stbradley wrote:
Greetings Everyone,
I like to use the Code::Blocks IDE to write C programs but to write C programs for my TI-84 Plus CE I use the CE C Toolchain. I use the Toolchain as described in the documentation, edit the program using Notepad++ and then open a command window to invoke make.

Now, one of the things Code::Blocks was designed to do was to have new compilers added to it, which I have done in the past. So yesterday I got to thinking I wonder if I could add the CE C Toolchain to Code::Blocks and use it's editor and compile my source directly from there. I like challenges, so yesterday I sat down and figured out how to incorporate the CE C Toolchain into Code::Blocks. Turns out it really wasn't that hard to do.

I was wondering if anyone here would be interested in me outlining the process? It is a little involved so I didn't want to post it if no one is interested.

I really have not been paying much attention recently, but does anyone still write C programs for the TI-84 Plus CE? I know TI stopped support a few years ago, which is why I've never upgraded my calculators OS so I can still run assembly and C programs.


Heya. I'm very interested in this. It sounds like a neat integration. I also think this would be helpful for new people trying to learn how to program in the C/C++ toolchain.
I have decided to post this info so that more people will hopefully decide to use the CodeBlocks IDE; possibly this coming school year. Also, this may look scary so I have broken it down into bite size pieces and into two separate posts. This first post will set up CodeBlocks while the second post includes bonus stuff I added to make the IDE more useful. Keep in mind you only need to do most of this once, for future projects simply follow the directions given in "Reuse a Project".

These instructions fully incorporate the CE C Toolchain into CodeBlocks. With CodeBlocks you will be able to include and edit single or multi-file C/C++ projects; build, rebuild and clean both "Release" or "Debug" versions. It incorporates the custom makefile the CE C Toolchain provides. You will also be able to use the CodeBlock features like code folding, code completion or ToDo lists. You can use plugins like the source code formatter to clean up messy code or use doxygen (DoxyBlocks) to fully document your code.

These instructions were written for Code::Blocks v. 20.03. Remember you only have to do this stuff once! This setup is for the Windows version of CodeBlocks. I have not got around to doing it on my linux version yet but it should be the same.

Tip: Whenever a [...] button can be used select it rather then type in info. This will get rid of most problems that can occur.

=======================
Set Up CE C Toolchain in CodeBlocks
=======================
1) Download CEdev, for Windows download 'windows_CEdev.exe.
2) Run the Installer. Install it at C:\CEdev
3) Run CodeBlocks.
4) From the CodeBlocks menu select Settings>Compiler.
5) Next, select the LLVM Clang Compiler from the 'Selected Compiler' pull down.
5) Click the [Copy] button.
6) In the 'Add new Compiler' box enter 'CE C Toolchain', click [OK].
7) Now select the 'CE C Toolchain' from the 'Select Compiler' pull down.
8.) Select 'Toolchain executables' tab and enter the following:
Compiler's installation directory: C:\CEdev
'Program Files' subtab. Don't enter these, rather, use the [...] button to navigate to the C:\CEdev\bin folder and select them.
C compiler: ez80-clang.exe
C++ compilerr: ez80-clang.exe
Make program: make.exe
9) 'Compiler settings' tab: Leave all the Compiler settings unchecked.
[Optional]
If you want to save a copy of the build log to an HTML file do this:
9a) 'Build options' tab. Scroll tabs to the right to get to this tab.
Click "Save Build Log to HTML file ..."
10) Click [OK] to save these settings

==================
Create a CodeBlocks Project
==================
Here I am going to show you how to create a CodeBlocks project and compile the hello_world example found in the C:\CEdev\examples folder using the main.c and makefile already saved there.
IMPORTANT: You only have to setup a Project once! For future projects follow 'Reuse a Project'.

1) Inside of the C:\CEdev folder create a new \projects folder.
2) Inside the \projects folder create a \HELLO folder
3) Copy these two files: makefile and \src\main.c from \examples\hello_world to \project\HELLO It is required that main.c be inside \src because that is where the makefile will look for it.
4) Start a new project in CodeBlocks: File >New Project...
5) Select 'Empty Project' or 'Console application' then click [Go].
4) Click [Next] then select language (C or C++) if asked and [Next]. Fill in the dialog box
Project Title: HELLO
Folder to create project in: C:\CEdev\projects
Project filename: HELLO.cbp
Resulting filename: C:\CEdev\projects\HELLO\HELLO.cbp
[Next]
5) In this next dialog you will create two build targets a "Debug" and a "Release".
Compiler: CE C Toolchain [It should be at the bottom of the list.]
Check 'Create "Debug" configuration'. Keep the name 'Debug'.
Check 'Create "Release"configuration. Give it the name you want. I use 'Ti84+CE'.
The output directory must be set to bin\ for Release and Debug.
[Finish]
You are now in the CodeBlocks IDE. At the right is the 'Project Manager'. Here all your files will appear (source, header, makefile, resource, manifest, etc.) Right now it should be empty until you add files to your project.
6) CodeBlocks may create a default 'main.c' in the HELLO folder. We are not going to use it so just remove it by clicking on it in the Project Manager, right click, 'Remove file from project'.

=======================
Add the custom makefile to a Project
=======================
Now you need to set up CodeBlocks to use the custom makefile that came with the source examples.
1) Project > Properties...
2) Title: HELLO (It is required that this be the same name as you give to your project HELLO.cbp)
3) Check the box 'This is a custom Makefike' then [OK]. Make sure the name of your makefile matches the name given and that it is in the folder with the project HELLO.cbp, not in the \src folder.
4) Project> Build Options > HELLO > Debug > "Make" commands tab
Change 'Build project/target to $make -f $makefile debug
Change Clean project/taget to $make -f $makefile clean
Change Ask if rebuild is needed:' to $make -f $makefile debug
5) Select HELLO > TI84+CE > "Make" commands tab. Click [Yes] if asked to save.
6) Build project/targets: $make -f $makefile
Change Clean project/taget to $make -f $makefile clean
Ask if rebuild is needed: $make -f $makefile

NOTE: As long as you are here you can setup the optional 'Auto-Archiving'. Select the 'Pre/post build steps' tab. See below.
7) Click [OK].

===============
Adding files to a Project
===============
You only need to do this when you want to add a new empty source or header file.
1) Select File>New>file... Select C/C++ source or header. [Go] [Next]
2) Select the type [Next].
3) Here you need to click on the [...] then double click on \src and enter the file name such as 'main' then [Save]
4) Click the [All] button then [Finish].

To add an existing file to the project do this
1) Select Project > Add files... Open \src folder and select main.c [Open] Check both the Release (i.e. TI-84+CE) and Debug then [OK].

Your file(s) should now appear in the Project Manager. You can add multiple files if you want.

==============
Compiling your source
==============
*** You should now be able to compile code successfully using CodeBlocks ***
You can switch targets between 'Debug' and 'TI84+CE' (Release) versions to be compiled.
1) There is a pull down menu in the Toolbar which allows you to select either 'TI84+CE' or 'Debug'. Select the one you want to use.
2) To compile the source file simply select Build > Build or use a shortcut. Your compiled file will be found in \bin.
To invoke 'clean' select Build > Clean. To Rebuild (Clean then Build) select Build > Rebuild or use the shortcut.

NOTE: If you get a message "Nothing to be done" select Build > Clean then compile.
If you set up "Save Build Log to HTML file ..." then the html will appear in the 'Logs' window. Click on it to open it.

==========
Reuse a Project
==========
One other feature of CodeBlocks is that you don;t have to go through all these steps every time you want to create a new project. Simply copy the .cbp project file to a new location and then modify it for your new project.
1) In a new project folder create a \src folder and [optionally] a \zip folder.
2) copy a makefile and a CodeBlocks .cbp file into the project folder.
3) Rename the .cbp if you want.
4) Project > Properties > Title: Enter your new projects title with the same name given to the .cbp (step 3) then [OK].
5) Add the makefile to your project then open Others > makefile > NAME ?= Enter name that will appear in the calculator menu (8 characters max) then save makefile.
6) You are now ready to add source files to your new project as outlined above.
As promised here is more info that I hope helps you out. I didn't include anything on using doxygen. It isn't that hard to set up but you do need to download and install it.

==========
Editing makefile
==========
You can add and edit the custom makefile to your project but you need to make one change to the editor.
1) To edit a makefile you need to use tabs, not spaces. Select Settings > Editor > General Settings. Check "Use TAB character". then [OK].
2) Select Project > Add file... then find the makefile and select it, click [open].
3) A new 'Other' field will appear in the project manager. Open it to edit the makefile.
4) In this example change NAME ?= DEMO to NAME ?= HELLO. This is the name that will appear in the calculators menu. It can be up to 8 characters. Be sure to save the change.

===============
Debugging your source
==============
To debug you will need to create a debug version of your program.
1) To debug a program add #include <debug.h> to your source.
2) Change the pull down menu in the menu bar to 'Debug'
3) Select Build > Rebuild or use a shortcut. (You can use Build > Build but Rebuild insures that you remove the 'Release' version).
4) See CEmu documentation for using debug.

=====
Build log
=====
The build log appears below your source file in the logs window when you compile your source. A copy of this log is saved in an html file if you followed the steps given above. To open it just double click on it.

======
Auto save
======
CodeBlocks can save your files every few minutes.
1) Settings > Environment > Autosave.

=========
Auto Archiving
=========
You can make a .zip file which backs up your files. The following will create a new backup every time you compile your source successfully. It will date stamp each zip file with the current date. You need to create a \zip folder in your project's folder before invoking this or you will get an error.
1) Project > Build options
2) HELLO > TI84+CE
3) 'Pre/post Build steps' tab.
4) Post-build steps copy this:
zip -j9 zip\$(PROJECT_NAME)_$(TODAY).zip makefile src\*.c bin\*.8xp $(PROJECT_NAME).cbp
5) Repeat for HELLO > Debug if you want to save debug also.
6) You must create a \zip folder inside the project folder or you will get an error.
You can add the time too if you want multiple files per day, simply replace $(TODAY) with $(NOW) or use $(WEEKDAY) for day of week i.e Monday. If you also have headers then add *.h

To create a zip file for uploading to Cemtech add a second copy of the commands on the next line, modify as needed, possibly add a README to the list.

=============
Enable Code Folding
=============
1) Settings > Editor > Folding > Enable folding

===========
Code Completion
==========
1) Settings > Editor > General settings > Editor settings tab.
2) Check the box 'Code Completion'
3) Scroll down to 'Code completion' for settings. You may have to exit Settings and return before 'Code completion' appears.

===========
Source formatter
===========
You can use the source formatter to clean up your code.
1) Settings > Editor > Source formatter
2) Select the way you want your code to look.
3) To use this select Plugins > Source code formatter (AStyle).

============
Default code
============
Enter default code that you want to appear whenever you create a new source or header file
1) Settings > Editor > Default code

Well, that's enough, you can explore on your own. Good Luck. I really hope someone finds this useful.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement