| You are not Logged In! |
Difference between revisions of "Public:Building and Debugging Code"
imported>Jonathan |
imported>Jonathan |
(No difference)
| |
Revision as of 18:03, 18 September 2018
Getting Started
- Have the code downloaded locally from Github. See: ((Github Setup))
- Have MCUXpresso installed and ready to go. See: ((MCUXpresso))
Building
File:67 # At this point you should have all of the proper projects imported (if the projects don't seem to be imported, try that again).
- Open the required projects (and close all others)
- The ONLY things you should have open are:
- mbed
- common
- <your>
- Close everything else that is open. You will be very sad if there are build error in other projects that make yours fail.
- The ONLY things you should have open are:
- Set all build configurations to whatever microcontroller is being used (probably LPC1549).
+
File:68 +
- Make sure the linker script location for your project is set correctly (on your project).
- Right click on the Project you are trying to build > Properties > C/C++ Build > Settings
- In "Tool Settings" go to MCU C++ Linker > Managed Linker Script
- Make sure that you have:
- Script name: -+LPC1549.ld+-
- Script path: -+..\..\mbed\libraries\mbed\targets\cmsis\TARGET_NXP\TARGET_LPC15XX\TOOLCHAIN_GCC_CR+-
- (If you can't change these uncheck "Manage Linker Script")
+
File:69 +
+
- Make sure the compiler language settings are set to the right thing (on mbed, common, and your project) If you don't
- Right click on Project > Properties > C/C++ Build Settings>Settings
- In "Tool Settings" go to MCU C++ Compiler > Dialect
- Language standard settings should be:
- For common: -+ISO C++11 (-std=c++11)+-
- For mbed: -+ISO C++11 (-std=c++0x)+-
+
File:70 +
- Build the project (ctrl+b). This will take a while (1-4 mins), especially when doing a full build for the first time. Future, incremental builds, should be faster as you won't need to recompile mbed (the OS) each time.
- If everything went well, then you now have a compiled binary file that you need to program/debug the microcontroller.
Flashing/Debugging
The way we flash code and debug is the same. Flashing code is just starting a debug session and then ending it right away. The steps to do so are:
Before you can debug you need to have a debugger configured. If using an LPC-Link2 it will work out of the box (usually) so you have no set-up. On ISC we typically use the DAP42 debugger (it is cheaper and more-reliable). Configuration instructions are below.
- Create the debug configuration (you'll only do this once per project)
- Select your project (NOT mbed or common, but your project) and open "Debug Configurations"
File:73 ##Double click on C/C++ (NXP Semiconductors) MCU Application to create a build configuration
- Name it appropriately (i.e. you don't want a bunch of configs called "new")
- Browse for the C/C++ Application you just built. It will be located in your project folder (in the repo) at -+LPC1549\projectname.axf+-
File:74 #Try hitting debug (the bug icon in the toolbar)
- If all goes well you'll see this dialog:
File:75 #You are now debugging. The debugger works just like a it does in Eclipse which is basically gdb. Except, if you try to use more than 4 breakpoints, it will crash and complain "resource not available."
Setting up the DAP42 debugger
Common Problems
Shadows template parm 'int N' and some other build errors that complain about types
You probably didn't set the compiler language correctly. Double check step 5 in Building.
Future
- Support program via CAN
Credit
This was made using the original LPCXpresso guide from Derek Chou (of Calsol and ISC) here: https://docs.google.com/document/d/1UbqKGVPCTO-VmLjGza0Km96y2tYtIO1zAWrmcexgvYg/