Difference between revisions of "Microchip tools"

From DIDEAS Wiki
Jump to: navigation, search
(MPLab IDE config)
Line 75: Line 75:
 
* the string "c:/src/this_project_root_directory" is replaced with your project root,
 
* the string "c:/src/this_project_root_directory" is replaced with your project root,
  
==MPLab IDE config==
+
==MPLAB IDE config==
 
*This IDE can be used to both edit and compile/build/program
 
*This IDE can be used to both edit and compile/build/program
 
To load a PF project, the default settings of the MPLAB IDE need to be changed:
 
To load a PF project, the default settings of the MPLAB IDE need to be changed:

Revision as of 19:49, 15 March 2012

  • Microchip Tools For Coding, Programming

Edit


Install software

Get the Firmware / Tortoise SVN

The SVN revision control system hosts the firmware and support scripts for the project. (user biomech, password:biomechXXX where XXX is the primary lab room number)

The project can be obtained from the SVN server with a tool call "Tortoise SVN" PDF DOC using either its "export" or "check out" feature. Both export and checkout make a local copy of the project, however checkout also embeds 'hidden' directories that Tortoise SVN uses to keep track of changes to the files, and the full path to the SVN server.

Most activity's with Tortoise SVN are initialed by right clicking on a folder. In the context menu, options such as "Tortoise SVN" and "SVN Repo-browser" may appear. Start by choosing SVN Repo-browser and pasting this URL: 'https://bmech.media.mit.edu:8443/svn/ric_powerfoot/'

One possible to obtain the project :

  • Check out the trunk to c:\src\trunk - this is the location that updates will appear and can be merged into your project.
  • Export the trunk to c:\src\my_trunk - this will be your local working copy
  • Pick a lab SVN server that you wish to keep the project.
  • Using repo brower, create a folder on the lab SVN server that describes your project eg : ".../code/cbarn/thesis_firmware"
  • Using repo browser check out that folder to "c:\src\my_trunk" - the directory to which you exported. Allow proceeding though the warning.
  • Now use "SVN commit" to submit the project into the lab SVN server. Right click on the folder "my_trunk", navigate to Tortoise SVN, and select "SVN commit". In the following dialog, select all the files that you want to have in the revision control system. (temp files, .o, .exe, etc should usually be ignored)


 example directory structure :
 c:\src\trunk\
               support_scripts
               KneeController
               MotorController
               StateController
    \my_trunk\
               support_scripts
               KneeController
               MotorController
               StateController

The advantage of this layout is that a tool such as "WinMerge" can be used to quickly propagate changes from the "trunk" to "my_trunk".

Configuration of Build Tools

Python support scripts config

The python interpreter needs to be added to the system path. Some other's explanation: Win7 Vista XP for Java

My version:

  • Ctrl click "My Computer" and then select "Properties"
  • From the new object, select the "Advanced" tab
  • Select "Environment Variables"
  • To the "PATH" variable, append "c:\python26;" (semicolons separate entries, do NOT include spaces between entries)
    • The path variable may exist under "user variable" and/or "system variables"
  • Verify that python is in the system path by starting a command shell trying to run python


A file that describes the directory structure of the project needs to be placed in "support_scripts" (which lives in the "project root directory"

  • Edit the file "support_scripts\python_paths.py", so its variables point the root of your project tree (c:\src\my_trunk). Here is the default python_paths.py :
# specifiy the location of the project root directory:
FIRMWARE_BASE_PATH = 'C:/src/this_project_root_directory';

# specify the location of critical files in the project
EEPROM_KEYS_RELATIVE_FNAME = 'StateController/eeprom_keys.h';
IOCHAN_RELATIVE_FNAME = 'StateController/Infrastructure/io_chan-rev2x0.h';
SC_GLOBAL_H_RELATIVE_FNAME = 'StateController/global.h'
  • the string "c:/src/this_project_root_directory" is replaced with your project root,

MPLAB IDE config

  • This IDE can be used to both edit and compile/build/program

To load a PF project, the default settings of the MPLAB IDE need to be changed:

  1. open "MPLAB IDE"
  2. Under Configure -> Settings select the "projects" tab
  3. Uncheck the "use one-to-one project-workspace model"

Some other suggested changes:

  • From the "other" tab, select "automatically reload"
  • From the "workspace" tab, select "no", "reload last workspace", and "always show full path"

Some programmer settings could also be changed

  • Select Programmer -> settings and then "Program after successful build"

After this works, try to open and compile a workspace/project.

  1. From MPLAB IDE, select "File, Open Workspace"
  2. Navigate to "trunk/StateController" and open "sc_workspace_mit.mcw" (or similar)
  3. Ignore complaint about files having been relocated.
  4. after it opens, press "Ctrl F10" to do a "make clean" followed by "make all"

Troubleshooting

  • "Couldn't locate build tool": Make sure the correct compiler is properly installed
  • "Could not spawn language tool":
    • PROBLEM: If you update to a new version of Python after having set up MPLab, you may get the following error: "Executing: C:\python26\python..\common_files\python_update_firmware.py -S Could not spawn language tool. Check command-line options."
    • SOLUTION: The build configurations are at the bottom of the ".mcp" files for each project. (h22.mcp for the Statecontroller, and "MC_300.mcp" for the motor controller). Open these files in a text editor and scroll to the bottom to the section labeled " [CUSTOM_BUILD] ". There is a line in this section that runs the python script.
      • Change "Pre-Build=C:\python26\python ..\common_files\python_update_firmware.py -S" to whatever python version you want to use, e.g.: "Pre-Build= C:\python27\python ..\common_files\python_update_firmware.py -S"

connect to the target (Pic32 or robot)

All the tools below live in the directory "support_scripts". Open a command shell and CD to that directory. Python is needed to run them and should be in your path.

wifi_fast.py

wifi_fast.py is the primary utility for receiving real-time telemetry from the target. It makes connection to the target via either a standard RS-232 serial port, or via a TCP connection. Once connected it reads telemetry, can log the data to a file, and can send the data via UDP for real-time plotting. It also sends keyboard characters to the target which can then be read via the C function 'getchar'.

Detailed documentation for wifi_fast


do_command.py

do_command.py is used to send 'special' commands to the robot.

do_command.py -h

robo_config.py

robo_config.py is used to read / write the robot's EEPROM and to read some the data structures in RAM.

robo_config.py -h

other tools