Creating a New Target - GaryA/antweight-esc GitHub Wiki
Creating a build for a new target (ESC) is designed to be very simple.
The most complicated part is figuring out the connections between the microcontroller and the rest of the circuit, and the polarity of the FET drive signals. This needs to be done very carefully in order to avoid potentially destroying a board. Once the circuit has been discovered a new target can be created.
- In uVision, go to
Project
->Manage
->Components, Environment, Books...
- In the
Project Targets
column, add a new target named as the board that it supports, capitalised with no spaces. For example,HobbyWing FlyFun 6A
becomesHobbyWingFlyFun6A
. - Click
Set as Current Target
thenOK
. - Create a new folder in the
Targets
folder with the same name as the target<TargetName>
- Copy the file
board.h
from theTargets\Generic
folder and place it in the new folder. - In uVision, go to
Project
->Options for Target...
and select theC51
tab. - Set
Include Paths
to.\Targets\<TargetName>
- Select the
Output
tab and click onSelect Folder for Objects...
. Select theTargets\<TargetName>
folder and click OK. - In
Name of Executable
enter the target name and click OK. - Ensure that the correct
board.h
file is open in the editor, the safest method is to closeboard.h
if it is open then re-open it from the project browser. - Edit the definitions in the
board.h
file to match the pin mappings of the board, taking account of any inversions in the polarity of the FET drive outputs. If dMOTOR_x_xx_POL is set to 1 a logic 1 will turn the corresponding FET on. - Building the code will result in a .hex file stored as
Targets\<TargetName>\<TargetNem>.hex