Initial commit
This commit is contained in:
commit
be3ecf3e6e
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "rodos"]
|
||||
path = rodos
|
||||
url = https://gitlab.com/rodos/rodos
|
7
CMakeLists.txt
Normal file
7
CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
project(my-rodos-app)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
add_subdirectory(rodos)
|
||||
add_rodos_executable(my-rodos-app blinky.cpp)
|
43
README.md
Normal file
43
README.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Julians Rodos Template
|
||||
|
||||
## Steps to make it work
|
||||
|
||||
### Compiling Rodos
|
||||
Compiling rodos for discovery / stm32f4:
|
||||
|
||||
```shell script
|
||||
$ cd build
|
||||
$ cmake -DCMAKE_TOOLCHAIN_FILE=../rodos/cmake/port/discovery.cmake -DEXECUTABLE=ON ..
|
||||
```
|
||||
|
||||
### Openocd installation
|
||||
|
||||
To make it work you need to install openocd on your system (e.g. via package manager).
|
||||
The installation should create one of these folders:
|
||||
- _/usr/share/openocd_
|
||||
- _/usr/local/share/openocd_
|
||||
|
||||
There you can find the files referenced in *openocd/openocd_debug.cfg* and *openocd/openocd_flash.cfg*.
|
||||
Since I did not find *stm32f4x_stlink.cfg* there, I changed it in the config file to *stm32f4x.cfg*.
|
||||
|
||||
### Edit Eclipse launch configs
|
||||
Eclipse needs to find the folder *eclipse_launch_cfgs*.
|
||||
For me it worked to create a new launch configuration and go to **Common** and select the folder unter **Shared files**.
|
||||
|
||||
You should also edit all three configurations through the Eclipse run configurations window to update your project name and binary name.
|
||||
|
||||
Sometimes *debug_stm32f4.launch* is not recognized by the big launch configuration window in Eclipse (top left). Just use the small bug icon on the top right of the toolbar instead.
|
||||
|
||||
### Run stm32f4-load
|
||||
Make *openocd/stm32f4-load* executable and run it once as sudo. This will add some files to */etc/udev/rules.d/* so you wont have to use sudo in the future.
|
||||
|
||||
### Edit CMakeLists.txt
|
||||
Edit *CMakeLists.txt* to add all your cpp files etc.
|
||||
|
||||
## How to run it
|
||||
### Flashing
|
||||
To flash your program just run the external tool configuration *flash_stm32f4* in Eclipse.
|
||||
|
||||
### Debugging
|
||||
To debug first run the external tool configuration *connect_stm32f4.launch* in Eclipse once.
|
||||
Then to really start debugging run the debug configuration *debug_stm32f4* in Eclipse. This should compile your code, open debug mode and run it.
|
38
blinky.cpp
Normal file
38
blinky.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* TestBlinky.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "rodos.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
HAL_GPIO green(GPIO_060);
|
||||
|
||||
|
||||
class Test:public Thread
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
void init()
|
||||
|
||||
{
|
||||
green.init(1,1,1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void run()
|
||||
|
||||
{
|
||||
green.setPins(0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Test t;
|
||||
|
0
build/.gitkeep
Normal file
0
build/.gitkeep
Normal file
9
eclipse_launch_cfgs/connect_stm32f4.launch
Normal file
9
eclipse_launch_cfgs/connect_stm32f4.launch
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="/usr/bin/openocd"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-f ${workspace_loc:/LRL_ex1/openocd/openocd_debug.cfg}"/>
|
||||
</launchConfiguration>
|
63
eclipse_launch_cfgs/debug_stm32f4.launch
Normal file
63
eclipse_launch_cfgs/debug_stm32f4.launch
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.connection" value="gdb:localhost:3333#"/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="monitor reset halt"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="Standard (Linux)"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_ENABLED" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_VALUE" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="cpsr-(format)" val="4"/><content id="fps-(format)" val="4"/><content id="f7-(format)" val="4"/><content id="f6-(format)" val="4"/><content id="f5-(format)" val="4"/><content id="f4-(format)" val="4"/><content id="f3-(format)" val="4"/><content id="f2-(format)" val="4"/><content id="f1-(format)" val="4"/><content id="f0-(format)" val="4"/><content id="pc-(format)" val="4"/><content id="lr-(format)" val="4"/><content id="sp-(format)" val="4"/><content id="r12-(format)" val="4"/><content id="r11-(format)" val="4"/><content id="r10-(format)" val="4"/><content id="r9-(format)" val="4"/><content id="r8-(format)" val="4"/><content id="r7-(format)" val="4"/><content id="r6-(format)" val="4"/><content id="r5-(format)" val="4"/><content id="r4-(format)" val="4"/><content id="r3-(format)" val="4"/><content id="r2-(format)" val="4"/><content id="r1-(format)" val="4"/><content id="r0-(format)" val="4"/><content id="nextBeat-Thread-null-UART::putchar-(format)" val="4"/><content id="nextBeat-Thread-null-main-(format)" val="4"/><content id="suspendedUntil-Thread-null-NVIC_SetPriority-(format)" val="4"/><content id="null-SystemInit-(format)" val="4"/><content id="FPCCR-null-SystemInit-(format)" val="4"/><content id="MVFR0-null-SystemInit-(format)" val="4"/><content id="MVFR1-null-SystemInit-(format)" val="4"/></contentList>"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList> <memoryBlockExpressionItem> <expression text="0x20000000"/> </memoryBlockExpressionItem> <memoryBlockExpressionItem> <expression text="0x2001fa00"/> </memoryBlockExpressionItem> <memoryBlockExpressionItem> <expression text="0x8000000"/> </memoryBlockExpressionItem> </memoryBlockExpressionList> "/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/my-rodos-app"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="LRL_ex1"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.cross.exe.debug.1708449299"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/LRL_ex1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||
<mapEntry key="[debug]" value="org.eclipse.cdt.debug.gdbjtag.core.cdiLaunchDelegate"/>
|
||||
</mapAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.cdt.debug.core.sourceLocator"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;project name=&quot;rodos&quot; referencedProjects=&quot;false&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.project"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;default/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;mapping backend_enabled=&quot;false&quot; name=&quot;Found Mappings&quot;&gt;&#10; &lt;mapEntry memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;mapEntry backendPath=&amp;quot;../src/independent&amp;quot; localPath=&amp;quot;/home/miru/programming/embedded/rodos_info8/rodos/src/independent&amp;quot;/&amp;gt;&amp;#10;&quot;/&gt;&#10;&lt;/mapping&gt;&#10;" typeId="org.eclipse.cdt.debug.core.containerType.mapping"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><memoryBlockExpressionList context="reserved-for-future-use"/>"/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
<stringAttribute key="saved_expressions<seperator>Unknown" value="20002800,0x20002800,0x2001ffa4,0x20002588,0x0800c4d4,0x20002924,0x2001ffff,0x2001fffe,0x2001fffc,0x20002538,0x800c534,0x2000258c,0x200028c8,0x2000116c,0x200010fc"/>
|
||||
</launchConfiguration>
|
9
eclipse_launch_cfgs/flash_stm32f4.launch
Normal file
9
eclipse_launch_cfgs/flash_stm32f4.launch
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${project}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/LRL_ex1/openocd/stm32f4-load}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="${workspace_loc:/LRL_ex1/build/my-rodos-app}"/>
|
||||
</launchConfiguration>
|
2
openocd/openocd_debug.cfg
Executable file
2
openocd/openocd_debug.cfg
Executable file
@ -0,0 +1,2 @@
|
||||
source [find interface/stlink-v2.cfg]
|
||||
source [find target/stm32f4x.cfg]
|
8
openocd/openocd_flash.cfg
Normal file
8
openocd/openocd_flash.cfg
Normal file
@ -0,0 +1,8 @@
|
||||
source [find interface/stlink-v2.cfg]
|
||||
source [find target/stm32f4x.cfg]
|
||||
|
||||
init
|
||||
reset halt
|
||||
flash write_image erase stm32f4.hex 0 ihex
|
||||
reset run
|
||||
shutdown
|
78
openocd/stm32f4-load
Executable file
78
openocd/stm32f4-load
Executable file
@ -0,0 +1,78 @@
|
||||
#! /bin/bash
|
||||
|
||||
#if [ -z $RODOS_ROOT ]; then
|
||||
# source `dirname $0`/print_no_envs_warning
|
||||
#fi
|
||||
|
||||
#source ${RODOS_MAKES}/stm32f4-set-vars
|
||||
|
||||
FLASH_TOOL=openocd
|
||||
FLASH_TOOL_PATH=/usr/bin
|
||||
OBJCOPY=arm-none-eabi-objcopy
|
||||
OBJCOPY_PATH=
|
||||
|
||||
ELF_NAME=$1
|
||||
|
||||
if [ -x ${FLASH_TOOL_PATH}/${FLASH_TOOL} ]; then
|
||||
echo "${FLASH_TOOL}: installed"
|
||||
FLASH_TOOL=${FLASH_TOOL_PATH}/${FLASH_TOOL}
|
||||
else
|
||||
# look for flash tool in default path
|
||||
command -v ${FLASH_TOOL} >/dev/null 2>&1 || { echo "${FLASH_TOOL}: NOT installed" >&2; exit 1; }
|
||||
echo "${FLASH_TOOL}: installed "
|
||||
FLASH_TOOL="$(command -v ${FLASH_TOOL})"
|
||||
fi
|
||||
|
||||
|
||||
if [ -x $OBJCOPY_PATH/$OBJCOPY ]; then
|
||||
echo "$OBJCOPY: installed"
|
||||
OBJCOPY=${OBJCOPY_PATH}/${OBJCOPY}
|
||||
else
|
||||
# look for objcopy in default path
|
||||
command -v ${OBJCOPY} >/dev/null 2>&1 || { echo "${OBJCOPY}: NOT installed" >&2; exit 1; }
|
||||
echo "${OBJCOPY}: installed"
|
||||
OBJCOPY="$(command -v ${OBJCOPY})"
|
||||
fi
|
||||
|
||||
|
||||
#if [ -f ./${ARCH}.elf ]; then
|
||||
# echo "${ARCH}.elf: OK"
|
||||
rm stm32f4.hex &> /dev/null
|
||||
$OBJCOPY -O ihex ${ELF_NAME} stm32f4.hex
|
||||
#else
|
||||
# echo "${ARCH}.elf: FAIL"
|
||||
# exit 1;
|
||||
#fi
|
||||
|
||||
|
||||
#if [ -f ./${ELF_NAME}.hex ]; then
|
||||
# echo "${ARCH}.hex: OK"
|
||||
#else
|
||||
# echo "${ARCH}.hex: FAIL"
|
||||
# exit 1;
|
||||
#fi
|
||||
|
||||
|
||||
|
||||
if [ ! -f /etc/udev/rules.d/49-stlinkv1.rules -o ! -f /etc/udev/rules.d/49-stlinkv2.rules ]
|
||||
then
|
||||
echo "superuser password needed to access USB-Port"
|
||||
|
||||
# mount rule for stlink1
|
||||
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"3744\", MODE:=\"0666\", SYMLINK+=\"stlinkv1_%n\"" > 49-stlinkv1.rules
|
||||
|
||||
# mount rule for stlink2
|
||||
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"3748\", MODE:=\"0666\", SYMLINK+=\"stlinkv2_%n\"" > 49-stlinkv2.rules
|
||||
|
||||
sudo mv 49-stlinkv1.rules /etc/udev/rules.d/
|
||||
sudo mv 49-stlinkv2.rules /etc/udev/rules.d/
|
||||
|
||||
sudo udevadm trigger
|
||||
sudo udevadm control --reload-rules
|
||||
|
||||
sleep 1s
|
||||
fi
|
||||
|
||||
|
||||
echo "flashing ..."
|
||||
${FLASH_TOOL} -f $(dirname "$0")/openocd_flash.cfg
|
1
rodos
Submodule
1
rodos
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 2c500a8d5af14e94c25e861dbcda2b3abde950e5
|
Loading…
x
Reference in New Issue
Block a user