Opens in a new tab

Online C compiler and debugger – how to speed up the development of your C code

I’m sure that you encountered with the situation when your code or part of your code didn’t work as you wanted – operation with a few pointers, logic operations, conditions, parsing of value from long array etc.

If you have modern microcontrollers and development board which supports debugger (e.g. STM32 and Nucleo, Discovery) you can easily step (debug) your code in debugger.

If you don’t have debugger, how do you follow values, variables? Are you using UART? Or LCD?

The change of code, compilation, comparison of results, and upload the code takes a much time.

If there is some tools which you help you with development of code faster, you should use that.

I have the best experience with Online C compiler/debugger called OnlineGDB.

Of course, it’s not necesary to use “Online”, you can download Eclipse or other IDE and debug the code there. But, I prefer this OnlineGDB compiler/debugger.

OnlineGDB

The compiler/debugger contains “Run” button. This button runs whole code.

The “Debug” button contains debugging of your code.

The debug can be stopped by “Stop” button.

If you want to share the code to your friends, you can use the “Share” button. You can also save the code by “Save” button.

The Online compiler/debugger OnlineGDB is used only for C, without controling of the peripherals.

So, the OnlineGDB detects a mistake in your code but it can’t control GPIO, I2C and another.

As I mentioned, that’s amazing tool when you have to detect the mistake in your code where you are using parsing of array, pointers, logical operators and conditions.

Btw, the OnlineGDB supports more programming languages like C++, Java, Python, PHP ….

Here is easy example of using:

We have a few variables and we calculate some result.

Click to “Run” for running of your code.

The whole code is run and you see the result in “Input” window.

So, if the behavior of your code is not the same as you expect you can write “printf” behind of each lines and check if the variables have expected value or not.

If you have Arduino, I guess that you will use UART.
Or you use debugger.

Debugger is tool which shows you values in variables, registers during the running of microcontroller.

So you can step the code, it means that you stop on every line of code – “Step over“. If there is function on the line and you want to go on function, you use “Step into” button.

The next opinion is using the breakpoints. That are point where you label the line where the code has to be stopped.

As I mentioned, you can’t copy-paste whole code e.g. from Arduino to this OnlineGDB. That’s not possible to control GPIOs, interfaces or other.

But you can easily debug your part of code where you want to parse of array, use logical operations, conditions and so on.
Home webpage of project: https://www.onlinegdb.com/

How to use debugger in OnlineGDB.


Share the article:
Show your
Maker soul!
Buy a T-Shirt
Coffee for Chiptron
Give a boost to the next article

Related Articles

AVR, ATMega, ATTiny, PIC, Arduino… these are very searching words in google and I asked myself “Why?”. Yes, AVR by Atmel or PIC by Microchip family is popular, but we can program better (modern, faster, more low-power, more peripherals) microcontrollers…

We wrote a news about STM32F746 discovery and IDE by openstm32.org on the google+. https://time4ee.com/ got development board STM32F7 discovery by ST. We want to show MULTIPLATFORM (Linux – Ubuntu, Windows) development tools by http://openstm32.org Other tutorials with STM32F7: Tutorial:…

CH32V microcontrollers – you’ve probably heard of them. They are sold at a ridiculously low price but come with a very decent set of features, plus they are available in a solder-friendly package. Among the peripherals, you’ll find not only…

We used AI to hack a toy from AliExpress. We identified the type and tried connecting to its memory to read it. Although it didn’t work, I gained a lot of useful insights.

The Chameleon Ultra is a compact RFID emulator that can clone LF (125 kHz) and HF (13.56 MHz) cards. It can read, write, and be used as a communication analyzer. It supports various cracking methods and is an open-source project…

ESP32, S2, S3, C3, C6, H2, C5, P4 and the upcoming S31 – which chip to choose for your project? Comparative peripherals table, use-case decision tree, software platforms overview, and tips on where to buy dev boards in Czechia.

Trends