Working debugger on Linux
With a simple code example of a blinking led on the F411 target
This commit is contained in:
parent
ee892d43b6
commit
ea3b880449
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
|
||||||
|
# Mac files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
outdir
|
||||||
|
**outdir
|
||||||
|
|
||||||
|
.built-in.o.cmd
|
||||||
|
.main.o.cmd
|
||||||
|
.browse.VC.db*
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "zephyrRC/zephyr-RC"]
|
[submodule "zephyr-RC"]
|
||||||
path = zephyrRC/zephyr-RC
|
path = include/zephyr-RC
|
||||||
url = https://github.com/philsson/zephyr-RC.git
|
url = https://github.com/philsson/zephyr-RC.git
|
||||||
|
53
.vscode/c_cpp_properties.json
vendored
Normal file
53
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Mac",
|
||||||
|
"includePath": [
|
||||||
|
"/usr/include",
|
||||||
|
"/Volumes/CrossToolNG/zephyr/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "clang-x64",
|
||||||
|
"browse": {
|
||||||
|
"path": [
|
||||||
|
"/usr/include",
|
||||||
|
"/Volumes/CrossToolNG/zephyr/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"macFrameworkPath": [
|
||||||
|
"/System/Library/Frameworks",
|
||||||
|
"/Library/Frameworks"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"includePath": [
|
||||||
|
"/usr/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "clang-x64",
|
||||||
|
"browse": {
|
||||||
|
"path": [
|
||||||
|
"/usr/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Win32",
|
||||||
|
"includePath": [
|
||||||
|
"c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "msvc-x64",
|
||||||
|
"browse": {
|
||||||
|
"path": [
|
||||||
|
"c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 3
|
||||||
|
}
|
46
.vscode/launch.json
vendored
Normal file
46
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"windows": {
|
||||||
|
"miDebuggerPath": "c:/dev/gcc-arm-6.2/bin/arm-none-eabi-gdb.exe"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
//"miDebuggerPath": "/usr/bin/gdb"
|
||||||
|
"miDebuggerPath": "/usr/bin/arm-none-eabi-gdb"
|
||||||
|
//"debugServerPath": "/usr/bin/openocd"
|
||||||
|
},
|
||||||
|
"targetArchitecture": "arm",
|
||||||
|
"program": "${workspaceRoot}/outdir/nucleo_f411re/zephyr.elf",
|
||||||
|
//"preLaunchTask": "debug_server",
|
||||||
|
"debugServerArgs": "",
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"setupCommands": [
|
||||||
|
{ "text": "file ${workspaceRoot}/outdir/nucleo_f411re/zephyr.elf" },
|
||||||
|
{ "text": "set remotetimeout 30" },
|
||||||
|
{ "text": "target remote localhost:3333" },
|
||||||
|
{ "text": "monitor halt" },
|
||||||
|
{ "text": "monitor reset init" },
|
||||||
|
{ "text": "load" },
|
||||||
|
{ "text": "info target" }
|
||||||
|
],
|
||||||
|
"externalConsole": false,
|
||||||
|
"cwd": "${workspaceRoot}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
//"type": "gdb",
|
||||||
|
//"request": "attach",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// For OpenOCD which has to run when gdb tries to connect
|
||||||
|
// $ PATH_TO_OPENOCD/bin/openocd
|
||||||
|
// -f PATH_TO_OPENOCD/scripts/board/stm32f4discovery.cfg
|
||||||
|
// -f PATH_TO_OPENOCD/scripts/interface/stlink-v2-1.cfg
|
||||||
|
// -c init
|
||||||
|
// -c "reset init"
|
50
.vscode/tasks.json
vendored
Normal file
50
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "0.1.0",
|
||||||
|
"linux" : {
|
||||||
|
"command": "bash",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"isShellCommand": true,
|
||||||
|
"showOutput": "always",
|
||||||
|
"args": [
|
||||||
|
"-c"
|
||||||
|
],
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"taskName": "clean",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"args": ["source ${workspaceRoot}/include/zephyr-RC/zephyr-env.sh && make clean && echo DONE"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "build",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"isBuildCommand": true,
|
||||||
|
"args": ["source ${workspaceRoot}/include/zephyr-RC/zephyr-env.sh && make BOARD=nucleo_f411re && echo DONE"],
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "cpp",
|
||||||
|
"fileLocation": ["relative", "${workspaceRoot}"],
|
||||||
|
"pattern": {
|
||||||
|
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"severity": 4,
|
||||||
|
"message": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "deploy",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"args": ["source ${workspaceRoot}/include/zephyr-RC/zephyr-env.sh && make BOARD=nucleo_f411re flash"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "debug_server",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
//"args": ["source ${workspaceRoot}/include/zephyr-RC/zephyr-env.sh && openocd -s /usr/local/share/openocd/scripts -f ${ZEPHYR_BASE}/boards/arm/nucleo_f411re/support/openocd.cfg -c 'init' -c 'targets' -c 'reset halt'"]
|
||||||
|
"args": ["source ${workspaceRoot}/include/zephyr-RC/zephyr-env.sh && openocd -s /usr/local/share/openocd/scripts -f ${ZEPHYR_BASE}/boards/arm/nucleo_f411re/support/openocd.cfg -c 'init' -c 'targets' -c 'reset init'"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
6
Makefile
Normal file
6
Makefile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#KERNEL_TYPE = nano
|
||||||
|
BOARD ?= nucleo_f411re
|
||||||
|
CONF_FILE = prj.conf
|
||||||
|
|
||||||
|
include ${ZEPHYR_BASE}/Makefile.inc
|
||||||
|
#include ./zephyr-RC/Makefile.inc
|
14
README.md
14
README.md
@ -1 +1,15 @@
|
|||||||
# RCNoster
|
# RCNoster
|
||||||
|
This project aims att developing an open-source remote control (RC) for radio controlled aircrafts e.g. drones and airplanes in both software and hardware.
|
||||||
|
|
||||||
|
## Hardware
|
||||||
|
In the RC hobby they are numerous developers of flight controllers (FC). These boards are powerfull and very cheap and many hobbyists have either a spair or an old unit lying around. Many of these boards derive from the [CC3D Revolution](http://opwiki.readthedocs.io/en/latest/user_manual/revo/revo.html) board based on the STM32F405 processor
|
||||||
|
|
||||||
|
The goal is to provide open CAD and Circuit Board designs for full customization and choice in electronics.
|
||||||
|
|
||||||
|
|
||||||
|
## Software
|
||||||
|
This software builds on the real-time operating system (RTOS) [Zephyr](https://zephyrproject.org/) created by the Linux Foundation.
|
||||||
|
The fork [Zephyr-RC](https://github.com/philsson/zephyr-RC.git) is included as a module for better support of the [CC3D Revolution](http://opwiki.readthedocs.io/en/latest/user_manual/revo/revo.html).
|
||||||
|
|
||||||
|
A Visual Studio Code project is set up for development and configured to work under Linux.
|
||||||
|
For dependencies and zephyr specific documentation see [Zephyr Documentation](https://www.zephyrproject.org/doc/)
|
5
prj.conf
Normal file
5
prj.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CONFIG_GPIO=y
|
||||||
|
CONFIG_NANO_TIMERS=y
|
||||||
|
CONFIG_NANO_TIMEOUTS=y
|
||||||
|
CONFIG_DEBUG=y
|
||||||
|
CONFIG_SERIAL=n
|
1
src/Makefile
Normal file
1
src/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
obj-y = main.o
|
38
src/main.c
Normal file
38
src/main.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <board.h>
|
||||||
|
#include <device.h>
|
||||||
|
#include <gpio.h>
|
||||||
|
|
||||||
|
/* Change this if you have an LED connected to a custom port */
|
||||||
|
//#define PORT "GPIOA"
|
||||||
|
#define PORT LED0_GPIO_PORT
|
||||||
|
|
||||||
|
/* Change this if you have an LED connected to a custom pin */
|
||||||
|
//#define LED 4
|
||||||
|
#define LED LED0_GPIO_PIN
|
||||||
|
|
||||||
|
/* 1000 msec = 1 sec */
|
||||||
|
#define SLEEP_TIME 500
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
int cnt = 0;
|
||||||
|
struct device *dev;
|
||||||
|
|
||||||
|
dev = device_get_binding(PORT);
|
||||||
|
/* Set LED pin as output */
|
||||||
|
gpio_pin_configure(dev, LED, GPIO_DIR_OUT);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
/* Set pin to HIGH/LOW every 1 second */
|
||||||
|
gpio_pin_write(dev, LED, cnt % 2);
|
||||||
|
cnt++;
|
||||||
|
k_sleep(SLEEP_TIME);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user