Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 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.
2 Answers
9 years, 7 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.
9 years, 7 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.
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 2015I 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