-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.11.1 release. Changes include: * Fix broken fault reporting * Add newlines to errorMessages * Add issue template and contributing message * Add PROS CLI template generation to automated build * Implement watchdog timer * Document watchdog timer and how best to work with it * Naming fixes and more accurate task timing * Update Jenkinsfile build * A new README for a new world
- Loading branch information
Showing
13 changed files
with
315 additions
and
1,061 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Contributing to PROS | ||
|
||
:tada: :+1: :steam_locomotive: Thanks for taking the time to contribute :steam_locomotive: :+1: :tada: | ||
|
||
**Did you find a bug?** | ||
- **Verify the bug lies in PROS.** We receive quite a few reports that are due to bugs in user code, not the kernel. | ||
- Ensure the bug wasn't already reported by searching GitHub [issues](https://github.com/purduesigbots/pros/issues) | ||
- If you're unable to find an issue, [open](https://github.com/purduesigbots/pros/issues/new) a new one. | ||
|
||
**Did you patch a bug or add a new feature?** | ||
1. [Fork](https://github.com/purduesigbots/pros/fork) and clone the repository | ||
2. Create a new branch: `git checkout -b my-branch-name` | ||
3. Make your changes | ||
4. Push to your fork and submit a pull request. | ||
5. Wait for your pull request to be reviewed. In order to ensure that the PROS kernel is stable, we take extra time to test pull requests. As a result, your pull request may take some time to be merged into master. | ||
|
||
Here are a few tips that can help expedite your pull request being accepted: | ||
- Follow existing code's style. | ||
- Document why you made the changes you did | ||
- Keep your change as focused as possible. If you have multiple independent changes, make a pull request for each. | ||
- If you did some testing, describe your procedure and results. | ||
- If you're fixing an issue, reference it by number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#### Expected Behavior: | ||
|
||
#### Actual Behavior: | ||
|
||
#### Steps to reproduce: | ||
|
||
#### System information: | ||
Kernel Version: | ||
|
||
#### Additional Information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
stage('Build') { | ||
def build_ver = '2.11.0' | ||
node('win') { | ||
def venv = new edu.purdue.pros.venv() | ||
stage('Clean') { | ||
if(isUnix()) { | ||
sh 'git init' | ||
sh 'git clean -x -d -f' | ||
} else { | ||
bat 'git init' | ||
bat 'git clean -x -d -f' | ||
} | ||
} | ||
stage('PROS CLI') { | ||
tool 'python3' | ||
if(isUnix()) { | ||
sh 'sudo apt-get install -y python3-pip' | ||
} | ||
venv.create_virtualenv() | ||
venv.run 'pip3 install --no-cache-dir git+git://github.com/purduesigbots/pros-cli.git@master', sudo = true | ||
} | ||
stage('Clone') { | ||
checkout scm | ||
if(isUnix()) { | ||
sh 'git describe --tags > version' | ||
} else { | ||
bat 'git describe --tags > version' | ||
} | ||
build_ver = readFile 'version' | ||
echo "Build PROS at version ${build_ver}" | ||
} | ||
toolchain_dir = tool 'arm-gcc' | ||
withEnv(["PROS_TOOLCHAIN=${toolchain_dir}"]) { | ||
venv.run 'pros conduct first-run --use-defaults --no-download --no-force' | ||
venv.run 'pros make template' | ||
} | ||
zip archive: true, dir: 'template', glob: '', zipFile: "kernel-template.zip" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* watchdog.h - IWDG API for reseting the cortex when something goes wrong | ||
* | ||
* Copyright (c) 2011-2016, Purdue University ACM SIGBots. | ||
* All rights reserved. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* PROS contains FreeRTOS (http://www.freertos.org) whose source code may be | ||
* obtained from http://sourceforge.net/projects/freertos/files/ or on request. | ||
*/ | ||
|
||
#ifndef WATCHDOG_H_ | ||
#define WATCHDOG_H_ | ||
|
||
/* | ||
* Public API Function to enable watchdog. | ||
* Must be called in initializeIO | ||
*/ | ||
void watchdogInit(); | ||
|
||
/* | ||
* Initilaizes the watchdog and feed task if watchdog is enabled | ||
*/ | ||
void watchdogStart(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,4 +96,5 @@ delayMicroseconds | |
micros | ||
millis | ||
wait | ||
waitUntil | ||
waitUntil | ||
iwdgEnable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* watchdog.c - IWDG API for reseting the cortex when something goes wrong | ||
* | ||
* Copyright (c) 2011-2016, Purdue University ACM SIGBots. | ||
* All rights reserved. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* PROS contains FreeRTOS (http://www.freertos.org) whose source code may be | ||
* obtained from http://sourceforge.net/projects/freertos/files/ or on request. | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include <watchdog.h> | ||
#include <task.h> | ||
|
||
static bool iwdgEnabled = false; | ||
|
||
// iwdgInit - Enables the watchdog | ||
void watchdogInit() { | ||
iwdgEnabled = true; | ||
} | ||
|
||
// iwdgFeed - Resets the watchdog's timer | ||
static inline void _iwdgFeed() { | ||
IWDG->KR = 0xAAAA; | ||
} | ||
|
||
static void _iwdgTask(void* ud) { | ||
(void)(ud); | ||
clock_t now = timeLowRes(); | ||
for (;;) { | ||
_iwdgFeed(); | ||
taskDelayUntil(&now, 125); | ||
} | ||
} | ||
|
||
// iwdgStart - Initializes the watchdog with a timeout | ||
void watchdogStart() { | ||
// implementation based on STM32 IWDG guidance. (https://goo.gl/sQaIF3) | ||
if (!iwdgEnabled) return; | ||
|
||
IWDG->KR = 0x5555; // enable access to iwdg reg (prevents accidental writes into iwdg cofig by runaway code) | ||
IWDG->PR = 2; // prescaler divides low speed internal (LSI) oscillator | ||
IWDG->RLR = 2500; // (timeout * 40) / exp(2, (2 + prescalerCode)) as per specification | ||
IWDG->KR = 0xAAAA; // refresh the watchdog (i.e. load these settings) | ||
IWDG->KR = 0xCCCC; // start the watchdog | ||
_iwdgFeed(); // feed it once and start the task | ||
|
||
taskCreate(_iwdgTask, TASK_MINIMAL_STACK_SIZE, NULL, TASK_PRIORITY_DEFAULT); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Universal C Makefile for MCU targets | ||
|
||
# Path to project root (NO trailing slash!) | ||
ROOT=.. | ||
# Binary output directory | ||
BINDIR=$(ROOT)/bin | ||
# Subdirectories to include in the build | ||
SUBDIRS= | ||
|
||
# Nothing below here needs to be modified by typical users | ||
|
||
# Include common aspects of this project | ||
-include $(ROOT)/common.mk | ||
|
||
ASMSRC:=$(wildcard *.$(ASMEXT)) | ||
ASMOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(ASMSRC:.$(ASMEXT)=.o)) | ||
HEADERS:=$(wildcard *.$(HEXT)) | ||
CSRC=$(wildcard *.$(CEXT)) | ||
COBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CSRC:.$(CEXT)=.o)) | ||
CPPSRC:=$(wildcard *.$(CPPEXT)) | ||
CPPOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CPPSRC:.$(CPPEXT)=.o)) | ||
OUT:=$(BINDIR)/$(OUTNAME) | ||
|
||
.PHONY: all do_subdirs _force_look | ||
|
||
# By default, compile program | ||
all: do_subdirs . | ||
|
||
# Phony force-look target | ||
_force_look: | ||
@true | ||
|
||
# Compiles the program if anything is changed | ||
.: $(SUBDIRS) $(ASMOBJ) $(COBJ) $(CPPOBJ) | ||
@touch . | ||
|
||
# Builds the subdirectories | ||
do_subdirs: _force_look | ||
@for dir in $(SUBDIRS); do $(MAKE) --no-print-directory -C $$dir || exit 1; done | ||
|
||
# Assembly source file management | ||
$(ASMOBJ): $(BINDIR)/%.o: %.$(ASMEXT) | ||
@echo AS $< | ||
@$(AS) $(AFLAGS) -o $@ $< | ||
|
||
# Object management | ||
$(COBJ): $(BINDIR)/%.o: %.$(CEXT) $(HEADERS) | ||
@echo CC $(INCLUDE) $< | ||
@$(CC) $(INCLUDE) $(CFLAGS) -o $@ $< | ||
|
||
$(CPPOBJ): $(BINDIR)/%.o: %.$(CPPEXT) $(HEADERS) | ||
@echo CPC $(INCLUDE) $< | ||
@$(CPPCC) $(INCLUDE) $(CPPFLAGS) -o $@ $< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Universal C Makefile for MCU targets | ||
# Top-level template file to configure build | ||
|
||
MAKE_COMMAND=make | ||
|
||
# Makefile for IFI VeX Cortex Microcontroller (STM32F103VD series) | ||
DEVICE=VexCortex | ||
# Libraries to include in the link (use -L and -l) e.g. -lm, -lmyLib | ||
LIBRARIES=$(wildcard $(ROOT)/firmware/*.a) -lgcc -lm | ||
# Prefix for ARM tools (must be on the path) | ||
MCUPREFIX=arm-none-eabi- | ||
# Flags for the assembler | ||
MCUAFLAGS=-mthumb -mcpu=cortex-m3 -mlittle-endian | ||
# Flags for the compiler | ||
MCUCFLAGS=-mthumb -mcpu=cortex-m3 -mlittle-endian -mfloat-abi=soft | ||
# Flags for the linker | ||
MCULFLAGS=-nostartfiles -Wl,-static -Bfirmware -Wl,-u,VectorTable -Wl,-T -Xlinker firmware/cortex.ld | ||
# Prepares the elf file by converting it to a binary that java can write | ||
MCUPREPARE=$(OBJCOPY) $(OUT) -O binary $(BINDIR)/$(OUTBIN) | ||
# Advanced sizing flags | ||
SIZEFLAGS= | ||
# Uploads program using java | ||
UPLOAD=@java -jar firmware/uniflash.jar vex $(BINDIR)/$(OUTBIN) | ||
|
||
# Advanced options | ||
ASMEXT=s | ||
CEXT=c | ||
CPPEXT=cpp | ||
HEXT=h | ||
INCLUDE=-I$(ROOT)/include -I$(ROOT)/src | ||
OUTBIN=output.bin | ||
OUTNAME=output.elf | ||
|
||
# Flags for programs | ||
AFLAGS:=$(MCUAFLAGS) | ||
ARFLAGS:=$(MCUCFLAGS) | ||
CCFLAGS:=-c -Wall $(MCUCFLAGS) -Os -ffunction-sections -fsigned-char -fomit-frame-pointer -fsingle-precision-constant | ||
CFLAGS:=$(CCFLAGS) -std=gnu99 -Werror=implicit-function-declaration | ||
CPPFLAGS:=$(CCFLAGS) -fno-exceptions -fno-rtti -felide-constructors | ||
LDFLAGS:=-Wall $(MCUCFLAGS) $(MCULFLAGS) -Wl,--gc-sections | ||
|
||
# Tools used in program | ||
AR:=$(MCUPREFIX)ar | ||
AS:=$(MCUPREFIX)as | ||
CC:=$(MCUPREFIX)gcc | ||
CPPCC:=$(MCUPREFIX)g++ | ||
OBJCOPY:=$(MCUPREFIX)objcopy |