OpenRE Environment Configuration

This section will describe how to configure the OpenRE development environment and burn test code under ubuntu.

Installation

There are two ways to install the software, you can install it directly with apt-get, or you can download the deb package from Baidu cloud if the network speed is too slow.

First of all, download the latest code: ``.

 git clone https://github.com/HANDS-FREE/OpenRE.git
$ cd 5_Development_Toolchain 
$ bash auto_set_openre_toolchain.sh

Then install the script, which will automatically download openocd, gcc-arm-none-eabi, stlink source packages from HandsFree Aliyun, and automatically decompress, compile, and install them.

$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded  
$ sudo apt-get update          
$ sudo apt-get install openocd  gcc-arm-none-eabi    
$ sudo usermod -a -G dialout $USER    
$ sudo apt-get install lib32ncurses5 libtool libusb-1.0 libftdi-dev python python-serial python-empy libpython2.7:i386    
$ sudo apt-get remove modemmanager

Code compilation and burn-in preparation

HandsFree currently has several different master controllers, such as control_unit_v2 for the Stone robot, and control_unit_mini for the Mini robot, when burning with jlink, because the external crystal frequency of different boards may not be the same, so burning the firmware of board A to board B may lead to a crash and Chip deadlock, the board program can not run and the next time the burn in, when this happens, the solution is to press the board's reset button (hold it still), run the burn instructions, a second or two later, release the reset button, it can be burned in.

In order not to have burn errors, you have to make sure that the makefile file of each project and your board model are matched first. Here is how to set up the makefile for each project first, and the next article will cover the makefile for the whole library in detail.

Example of a project's makefile.

######################################define project name, board type, and path

#####ROBOT_MODEL : null mini stone stone_v2 stone_v3 stone_v3_omni giraffe virtual
ROBOT_MODEL     ?= stone_v3
#####BOARD_TYPE: openre_board_mini openre_board_v2
BOARD_TYPE      ?= openre_board_v2
#####project name
PROJECT         =  robot_$(ROBOT_MODEL)_$(BOARD_TYPE)
TOP_PATH        =  ../../../..

#############################################################parameters

#####BOOTLOADER  : enable disable
BOOTLOADER_MODE ?= disable

##########################################################################source

CXX_SRC         += ../src/main.cpp 

#Includes
INCDIR          += -I. -I../src/ 

#########################################################################package

#PAKG: common robot_abstract math imu .....
PAKG        = common robot_abstract math imu motor sbus_ppm servo \
              robot_control hf_link tf

#OS_MODULE: UCOSII UCOSIII GUI FAT
OS_MODULE  =           

#LIB_MODULE: EIGEN MATRIX  etc
THIRDPARTY_MODULE = 

###################################################################include rules

include $(TOP_PATH)/0_Project/makefile/compiler.mk

The variable to the left of the equal sign is the variable, the variable value to the right of the equal sign, # is the comment line, and the part after the comment is the optional value of the variable. The meaning of each variable is described next.

  • ROBOT_MODEL: is the model of the robot used, the optional values are several robots released by HandsFree, (mini, stone, stone_v2, stone_v3, stone_v3_omni, giraffe, null means this project has nothing to do with robot objects, it will be used when running the OpenRE sample tutorial program (When running the OpenRE tutorial program, null will be used, virtual represents the use of a virtual semi-physical simulation model, OpenRE will virtualize the motor model and a differential robot, the internal kinematics and odometer settlement are achieved using the internal virtual semi-physical model, often used in debugging the upper computer virtual).
  • BOARD_TYPE: main control board model, optional value is HandsFree's several main control boards (currently two, openre_board_mini, openre_board_v2).
  • BOOTLOADER_MODE: BOOTLOADER mode allows users to download programs directly from the serial port, if disable, you need to use jlink to download. Currently the default is disable.
  • PAKG: represents the function package that this program needs to use, in the simple test code, only the common package is used. In the robot project code, it is used more. If you do not develop your own program, this part is generally not modified.
  • OS_MODULE: the mode of the operating system, currently supports UCOSII, UCOSIII. if bare running microcontroller program, it will be empty without filling.
  • THIRDPARTY_MODULE: The choice of third-party libraries, such as matrix libraries and so on, if used to fill in the corresponding third-party library name here.

Before the burning, please make sure your makefile configuration is correct, mainly ROBOT_MODEL, BOARD_TYPE these two variables, if the configuration is not correct, there will be a possibility of chip deadlock, if inadvertently deadlock, the next burn before the reset button, release the reset button during the burning process to unlock.

Please make sure that you plan to learn the underlying embedded development, and that the firmware of the corresponding robot has been burned when HandsFree is shipped.

Burn a running light code to test

cd OpenRE/0_Project/examples/handsfree_simple_app/linux

  • Modify the makefile according to the previous step.
  • Plug in the jlink while powering the board with usb.
  • Then compile. make clean make
  • And finally burn. make burn

After the successful burn, the led on the board will keep blinking.

If you are using STLink instead of the official Jlink, you need to change 0_Project/makefile/flash.mk before make burn as follows:

ifeq "$(strip $(BOOTLOADER_MODE))" "enable"
BURN_TYPE           = usbttl_bootloader_upload 
else
# (stlink/swd/jlink)_(stlink/openocd)_flash  "device"_"driver"_flash
BURN_TYPE               = swd_openocd_flash
DEBUG_TYPE        = swd_openocd_debug
ERASE_TYPE        = swd_openocd_erase
endif

Change:

ifeq "$(strip $(BOOTLOADER_MODE))" "enable"
BURN_TYPE           = usbttl_bootloader_upload 
else
# (stlink/swd/jlink)_(stlink/openocd)_flash  "device"_"driver"_flash
BURN_TYPE               = stlink_openocd_flash
DEBUG_TYPE        = stlink_openocd_debug
ERASE_TYPE        = stlink_openocd_erase
endif

(Note: If you are burning the same code repeatedly, you can skip the make clean and make steps from the second time and just make burn.) ## If there are .h headers modified between burns, you have to make clean first, then make, and finally make burn.

Burning the robot's firmware program

There are two versions of the firmware program, the OS version and the bare-metal version, the bare-metal version is the stable version, and the OS version is tested to work properly. If you do not know, then the bare metal version is recommended.

Bare metal version: 0_Project/firmware/handsfree_wheel_robot
OS version: 0_Project/firmware/handsfree_wheel_robot_ucosIII

The burning method is the same as above, but it is worth noting that you have to change the Makefile first to choose a different way of robot and master control

The main thing is to modify the following two variables:

#####ROBOT_MODEL : null mini stone stone_v2 stone_v3 stone_v3_omni giraffe virtual
ROBOT_MODEL     ?= stone_v3
#####BOARD_TYPE: openre_board_mini openre_board_v2
BOARD_TYPE      ?= openre_board_v2

One is to select the board model and the other is to select the robot model. The options are marked as comments in the makefile.
Stone, Giraffe series robot platform uses openre_board_v2 controller, Mini robot uses openre_board_mini.

These two variables must be selected correctly, otherwise there will be accidents, such as deadlocking the controller, or burning the wrong robot code, resulting in abnormal motion control, if inadvertently deadlocked, the next time before burning the write first hold down the reset button, burning process release the reset button can be unlocked.

(Note: Non-embedded developers only need to see here, those who want to develop OpenRE in depth can continue to study the OpenRE tutorial later)

results matching ""

    No results matching ""