4 years, 8 months ago.

Code compiled offline doesn't behave as espected

Hello everyone!

I'm sorry if there is a similar question but I couldn't find it. I tried to export my project to almost all the platforms available at the "Export program" option. I tried gcc4mbed as well. I was succeful compiling them, but the code doesn't behave as the code compiled in the online IDE. And it's not just a slightly performance issue, the robot (it's a line follower robot) doesn't do anything right. It just does random different things every time you turn it on.

I have no idea what I'm missing. Is there any setup necessary, beside the ones in the handbook? I'm using a LPC1768.

Thank you all.

Hi Jonas - This is a very broad and general question. I don't think you'll get much help without better sharing more details about what and how things aren't working. Even steps other people without bespoke hardware could reproduce would help.

posted by Sam Grove 08 Apr 2015

I can't get the code to work properly, It compiles, generates de binary, but it doesn't work properly. The robot is supposed, at least, to follow a straight white line on the black floor, and it does it beautifully with the code compiled in the online compiler. But if I export the project to lpcxpresso, for example, and compile it there (with no errors or warnings), the robot follows the line for a short time, then just turns and starts to do random things. I feel like there is some setup I am missing. Like setting up an external oscilator or something, I have no idea what could be wrong.

I tried gcc4mbed too. I export the project to "Gcc ARM", then I run the BuildShell.cmd in the gcc4mbed folder (after succesfully running win_install.cmd), open the folder of the exported project, and run the command "make". It generates a binary, no errors, no warnings. But it also doesn't work properly.

Now the online compiler is down again and the competition starts in a couple hours.

If anyone could give me all the right steps to compile the gcc exported program with gcc4mbed in the simplest way... or any alternatives.

posted by Jonas Mazza Fernando 08 Apr 2015
Comment on this question

2 Answers

4 years, 8 months ago.

There can be some implementation defined or even undefinied behavior in your code, or not properly handling interrupts. It's hard to guess, but I would start playing with optimizations and code separation to find the block which triggers this different behavior.

online IDE using ARMCC with Optimization set to 3, try gcc arm with Opt set to O0, Os or O3, which have used this simple makefile with gcc (you might need to modify it for your program) https://github.com/0xc0170/mbed_gcc_makefile

How big is your program? free version uVision allows up to 32k.

4 years, 8 months ago.

If your program uses a lot of RAM, after some limit there occurs a lot of problems...like yours, and this is difficult to monitor
The RAM usage is a important difference between the compilers. I have a MUCH lower RAM usage with the last gcc arm (gcc-arm-none-eabi-4_9-2015q1)with a 1768.


You need to log in to post a question