Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
RUSTFLAGS: -D warnings # Warnings disabled only in CI
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -39,16 +39,17 @@ jobs:
# run: cargo test
#- name: Clippy
# run: cargo clippy -- -Dwarnings

freertos-rust-stable:
name: Build freertos-rust using stable
runs-on: ubuntu-latest
# env:
# RUSTFLAGS: -D warnings # Warnings disabled only in CI
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -60,31 +61,37 @@ jobs:
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --verbose --no-default-features --features=sync,time,hooks,interrupt --package freertos-rust # Don't build the whole workspace because the examples use nightly features which will fail the build

freertos-rust-examples:
name: Build examples
runs-on: ubuntu-latest
strategy:
matrix:
include:
#- example: win
# target: x86_64-pc-windows-gnu
#- example: linux
# target: x86_64-unknown-linux-gnu
- example: win
target: x86_64-pc-windows-msvc
os: windows-latest
- example: linux
target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- example: stm32-cortex-m3
target: thumbv7m-none-eabi
os: ubuntu-latest
- example: stm32-cortex-m4-blackpill
target: thumbv7em-none-eabihf
#- example: nrf9160
# target: thumbv8m.main-none-eabihf
os: ubuntu-latest
- example: nrf9160
target: thumbv8m.main-none-eabihf
os: ubuntu-latest
runs-on: ${{ matrix.os }}
#env:
# RUSTFLAGS: -D warnings # Warnings disabled only in CI
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
submodules: recursive
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -97,6 +104,7 @@ jobs:
with:
targets: ${{ matrix.target }}
- name: Install cross deps
if: matrix.os == 'ubuntu-latest'
run: |
case ${{ matrix.target }} in
"x86_64-pc-windows-gnu")
Expand Down
12 changes: 7 additions & 5 deletions freertos-rust-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,24 @@ repository = "https://github.com/lobaro/FreeRTOS-rust"
[dependencies]
freertos-rust = {path = "../freertos-rust"}

[target.'cfg(target_arch = "arm")'.dependencies]
cortex-m = "0.7"
cortex-m-rt = "0.7"

# Example: stm32-cortex-m3
[target.thumbv7m-none-eabi.dependencies]
cortex-m = "0.7"
cortex-m-rt = "0.7"
stm32f1xx-hal = {version = "0.10", features = ["rt", "stm32f103", "medium"]}

# Example: stm32-cortex-m4-blackpill
[target.thumbv7em-none-eabihf.dependencies]
cortex-m = "0.7"
cortex-m-rt = "0.7"
embedded-hal = "1.0"
stm32f4xx-hal = {version = "0.22", features = ["stm32f411"]}

# Example: nrf9160
[target."thumbv8m.main-none-eabihf".dependencies]
nrf9160-pac = "0.2.1"
cortex-m = "0.7"
cortex-m-rt = "0.7"
nrf9160-pac = {version = "0.12", features = ["rt"]}

# Example: win
[target.x86_64-pc-windows-gnu.dependencies]
Expand Down
4 changes: 3 additions & 1 deletion freertos-rust-examples/examples/linux/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ extern void vAssertCalled( const char * const pcFileName, unsigned long ulLine )
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
/*#include "trcKernelPort.h" */

#define portYIELD_FROM_ISR( x ) ( void ) x
Comment thread
schteve marked this conversation as resolved.

#ifdef __cplusplus
}
#endif


#endif /* FREERTOS_CONFIG_H */
#endif /* FREERTOS_CONFIG_H */
4 changes: 1 addition & 3 deletions freertos-rust-examples/examples/linux/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ fn main() {
let x = Box::new(15);
println!("Boxed int '{}' (allocator test)", x);

unsafe {
FREERTOS_HOOKS.set_on_assert(|| { println!("Assert hook called") });
}
FREERTOS_HOOKS.set_on_assert(|| { println!("Assert hook called") }).unwrap();

//println!("Calling assert ...");
//FreeRtosUtils::invoke_assert();
Expand Down
24 changes: 10 additions & 14 deletions freertos-rust-examples/examples/nrf9160/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#![no_std]
#![no_main]
// For allocator
#![feature(lang_items)]
#![feature(alloc_error_handler)]
#![allow(dead_code)]
#![allow(unused)]


use cortex_m_rt::{entry, exception, ExceptionFrame};
Expand All @@ -11,26 +10,18 @@ use cortex_m::asm;

use core::panic::PanicInfo;
use freertos_rust::*;
use core::alloc::Layout;

#[global_allocator]
static GLOBAL: FreeRtosAllocator = FreeRtosAllocator;

// define what happens in an Out Of Memory (OOM) condition
#[alloc_error_handler]
fn alloc_error(_layout: Layout) -> ! {
asm::bkpt();
loop {}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}


#[exception]
unsafe fn DefaultHandler(irqn: i16) {
unsafe fn DefaultHandler(_irqn: i16) {
do_blink();
// custom default handler
// irqn is negative for Cortex-M exceptions
Expand All @@ -41,7 +32,8 @@ unsafe fn DefaultHandler(irqn: i16) {


#[exception]
fn HardFault(_ef: &ExceptionFrame) -> ! {
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
asm::bkpt();
do_blink();
loop {}
}
Expand Down Expand Up @@ -95,14 +87,18 @@ fn test_function(arg: i32) -> i32 {

// FreeRTOS handler

#[allow(non_snake_case)]
#[no_mangle]
fn vApplicationMallocFailedHook() {}

#[allow(non_snake_case)]
#[no_mangle]
fn vApplicationIdleHook() {}

#[allow(non_snake_case)]
#[no_mangle]
fn vApplicationStackOverflowHook(pxTask: FreeRtosTaskHandle, pcTaskName: FreeRtosCharPtr) {}

#[allow(non_snake_case)]
#[no_mangle]
fn vApplicationTickHook() {}
fn vApplicationTickHook() {}
7 changes: 1 addition & 6 deletions freertos-rust-examples/examples/win/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ fn main() {
let x = Box::new(15);
println!("Boxed int '{}' (allocator test)", x);

unsafe {
FREERTOS_HOOKS.set_on_assert(|| { println!("Assert hook called") });
}
FREERTOS_HOOKS.set_on_assert(|| { println!("Assert hook called") }).unwrap();

//println!("Calling assert ...");
//FreeRtosUtils::invoke_assert();
Expand All @@ -29,9 +27,6 @@ fn main() {
// println!("Free Memory: {}!", free);
println!("Starting scheduler");
FreeRtosUtils::start_scheduler();
loop {
println!("Loop forever!");
}
}

#[test]
Expand Down
159 changes: 0 additions & 159 deletions freertos-rust/src/freertos/ports/arm/hooks.c

This file was deleted.

Loading