Hey! welcome to this repo.
- Download ARM GCC toolchain 9-2019-q4-major. 10.3-2021.10 You should get gcc-arm-none-eabi-9-2019-q4-major-win32.zip file or equivalent.
- Create a folder on C drive called TOOLCHAIN -> "C:/TOOLCHAIN/". After the folder is created, extract toolchain here. Toolchain path should look like C:/TOOLCHAIN/9-2019-q4-mayor same as makefile shown on line 7.
- Download and Install Cygwin.
- Add C:/cygwin64/bin folder to the PATH. To test this step works, open a CMD console and type "grep" or "mv".
- Install GIT on windows computer. Download the installer from here.
- Open a new CMD terminal and configure git with your user name and password. For example:
git config --global user.name "Your Name"
and alsogit congig --user.mail "your_email@something.com"
- Download GNU MCU Eclipse Windows Build Tools from here. In the case you didn't get the installer file, copy the folder "GNU MCU Eclipse" into C driver, and put it into the program folder.
- Add GNU MCU Eclipse Windows Build Tools folder to PATH: Example: "C:\Program Files\GNU ARM Eclipse\Build Tools\2.6-201507152002\bin". To test this step works, open a CMD console and type "make".
- Congratulation!!! You should be able to clone and compile this project by typing
make -j8
ormake all
and clean by typingmake clean
from the project root folder.
$ sudo apt-get update && apt-get upgrade
$ sudo apt-get install build-essential && apt-get install git
$ sudo dnf check-update
$ sudo dnf install make automake gcc gcc-c++ kernel-devel && sudo dnf install git
- Download ARM GCC toolchain from here. You should have this file or equivalent in the system ready to be installed or extracted gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2.
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
- Uncompressed file.
$ tar -xvjf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
- Make new dir where toolchain will live.
$ sudo mkdir /opt/arm-toolchain/
- Copy toolchain to default project folder.
$ sudo mv ./gcc-arm-none-eabi-9-2019-q4-major /opt/arm-toolchain/gcc-arm-none-eabi-9-2019-q4-major
- Congratulation!!! You should be able to clone and compile this project by typing
$ make -j8
or$ make all
and clean by typing$ make clean
on project root folder.
- ...
-
Install STLink package here.
-
Verify connection with:
$ st-info --probe
-
Flash firmware with:
$ st-flash write <example>.bin 0x8000000
Example task for blinking LEDs.
#include <hardware/hardware-manager.hpp>
static HardwareManager s_manager;
static Led *s_led;
static bool s_led_on = false;
void task_blink_thread(void*)
{
s_led = s_manager.get_led();
s_manager.init();
for ( ;; )
{
s_led->set_led_1(s_led_on);
s_led->set_led_2(!s_led_on);
s_led->set_led_3(s_led_on);
s_led_on = !s_led_on;
s_manager.update();
vTaskDelay(250);
}
}
Hardware Manager Config.
struct Hardware_Config
{
uint16_t neoled_update_interval;
uint16_t led_update_interval;
uint16_t imu_update_interval;
};
Hardware_Config example_config
{
.neoled_update_interval = 40,
.led_update_interval = 250,
.imu_update_interval = 5,
}
Actuator interface.
class Actuator
{
public:
virtual void init() = 0;
virtual void update() = 0;
};
Lego Motor interface.
class LegoMotor
{
public:
virtual void forward(int32_t rotation) = 0;
virtual void backward(int32_t rotation) = 0;
virtual void stop() = 0;
virtual void start_sync(LegoMotor *motor) = 0;
virtual void end_sync() = 0;
virtual bool is_stalled() = 0;
virtual int32_t get_tacho_count() = 0;
virtual void set_motor_pwm(uint8_t motor_pwm) = 0;
virtual uint8_t get_motor_pwm() = 0;
virtual void set_motor_encoder(uint8_t motor_encoder) = 0;
virtual uint8_t get_motor_encoder() = 0;
virtual void set_motor_speed(uint32_t motor_speed) = 0;
virtual uint32_t get_motor_speed() = 0;
private:
virtual void drive_motor(float speed, int32_t rotation) = 0;
};
Current Actuators
NeoLED
LEDs
Device interface.
class Device
{
public:
virtual void init() = 0;
virtual void update() = 0;
};
Lego Device interface.
class LegoDevice
{
public:
virtual void init() = 0;
virtual void update() = 0;
};
unknown if needed.
Sensor interface.
class Sensor
{
public:
virtual void init() = 0;
virtual void update() = 0;
};
Lego Sensor interface.
class LegoSensor
{
public:
virtual void init() = 0;
virtual void update() = 0;
virtual void set_mode(uint8_t mode) = 0;
virtual uint8_t get_mode() = 0;
};
Current Sensors:
IMU
Buttons