-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1911: New Platform: Msp432 r=bradjc a=lebakassemmerl ### New Platform Support for the MSP-EXP432P401R Eval-Board This pull-request adds support for MSP432P401R chip from Texas Instruments. The implementation is currently very, very basic, only the GPIO-module is properly implemented in order to create a panic-handler which blinks an LED and to be able to test a simple user-space application. If this PR will be accepted, the next step would be to implement the UART and timer modules for supporting debug-output and delays in userspace. ## Adding a Platform to Tock Repository - [x] The hardware must be widely available. Generally that means the hardware platform can be purchased online. - The port of Tock to the platform must include at least: - [x] Console support so that debug!() and printf() work. - [x] Timer support. - [x] GPIO support with interrupt functionality. - [x] The contributor must be willing to maintain the platform, at least initially, and help test the platform for future releases. Co-authored-by: hotschi <hotschi@gmx.at>
- Loading branch information
Showing
25 changed files
with
4,775 additions
and
0 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
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,13 @@ | ||
[package] | ||
name = "msp-exp432p401r" | ||
version = "0.1.0" | ||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"] | ||
build = "build.rs" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
components = { path = "../components" } | ||
cortexm4 = { path = "../../arch/cortex-m4" } | ||
capsules = { path = "../../capsules" } | ||
kernel = { path = "../../kernel" } | ||
msp432 = { path = "../../chips/msp432" } |
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,23 @@ | ||
# Makefile for building the tock kernel for the MSP-EXP432P401 launchpad | ||
# | ||
TARGET=thumbv7em-none-eabi | ||
PLATFORM=msp-exp432p401r | ||
|
||
include ../Makefile.common | ||
|
||
OPENOCD=openocd | ||
OPENOCD_OPTIONS=-f openocd.cfg | ||
APP_START_ADDR=0x20000 | ||
APP?= | ||
|
||
.PHONY: flash-debug | ||
flash-debug: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/debug/$(PLATFORM).elf | ||
$(OPENOCD) $(OPENOCD_OPTIONS) -c "init; reset halt; flash write_image erase $<; verify_image $<; reset; shutdown" | ||
|
||
.PHONY: flash | ||
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf | ||
$(OPENOCD) $(OPENOCD_OPTIONS) -c "init; reset halt; flash write_image erase $<; verify_image $<; reset; shutdown" | ||
|
||
.PHONY: flash-app | ||
flash-app: | ||
$(OPENOCD) $(OPENOCD_OPTIONS) -c "init; reset halt; flash write_image erase $(APP) $(APP_START_ADDR) bin; verify_image_checksum $(APP) $(APP_START_ADDR) bin; reset; shutdown" |
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,33 @@ | ||
MSP432 Evaluation kit MSP432P401R MCU | ||
===================================== | ||
|
||
For more details [visit the Evaluation kit website](https://www.ti.com/tool/MSP-EXP432P401R). | ||
|
||
## Flashing the kernel | ||
|
||
The kernel can be programmed using OpenOCD. `cd` into `boards/msp_exp432p401r` | ||
directory and run: | ||
|
||
```bash | ||
$ make flash | ||
|
||
(or) | ||
|
||
$ make flash-debug | ||
``` | ||
|
||
**Note:** Make sure to use the latest git-openOCD-version as there is currently no support for the | ||
XDS110 debug-probe in the pre-built binaries! | ||
|
||
## Flashing an app | ||
|
||
Apps are also flashed via openOCD. Make sure, your app is was compiled and converted into the TBF | ||
(Tock Binary Format) format. Then `cd` into the `boards/msp_exp432p401r`directory and run: | ||
|
||
```bash | ||
$ make flash-app APP=<path_to_tbf_file> | ||
|
||
(e.g.) | ||
|
||
$ make flash-app APP=../../../libtock-c/examples/c_hello/build/cortex-m4/cortex-m4.tbf | ||
``` |
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,5 @@ | ||
fn main() { | ||
println!("cargo:rerun-if-changed=layout.ld"); | ||
println!("cargo:rerun-if-changed=chip_layout.ld"); | ||
println!("cargo:rerun-if-changed=../kernel_layout.ld"); | ||
} |
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,9 @@ | ||
/* Memory Space Definitions, 256K flash, 64K ram */ | ||
MEMORY | ||
{ | ||
rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K | ||
prog (rx) : ORIGIN = 0x00020000, LENGTH = 128K | ||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K | ||
} | ||
|
||
MPU_MIN_ALIGN = 4K; |
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,2 @@ | ||
INCLUDE ./chip_layout.ld | ||
INCLUDE ../kernel_layout.ld |
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,6 @@ | ||
adapter driver xds110 | ||
adapter speed 2500 | ||
source [find board/ti_msp432_launchpad.cfg] | ||
|
||
init; | ||
reset halt; |
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,57 @@ | ||
use crate::CHIP; | ||
use crate::PROCESSES; | ||
|
||
use core::fmt::Write; | ||
use core::panic::PanicInfo; | ||
use kernel::debug; | ||
use kernel::debug::IoWrite; | ||
use kernel::hil::led; | ||
use msp432::gpio::PinNr; | ||
|
||
/// Uart is used by kernel::debug to panic message to the serial port. | ||
pub struct Uart { | ||
initialized: bool, | ||
} | ||
|
||
/// Global static for debug writer | ||
pub static mut UART: Uart = Uart { initialized: false }; | ||
|
||
impl Uart { | ||
/// Indicate that UART has already been initialized. | ||
pub fn set_initialized(&mut self) { | ||
self.initialized = true; | ||
} | ||
} | ||
|
||
impl Write for Uart { | ||
fn write_str(&mut self, s: &str) -> ::core::fmt::Result { | ||
self.write(s.as_bytes()); | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl IoWrite for Uart { | ||
fn write(&mut self, buf: &[u8]) { | ||
unsafe { | ||
msp432::uart::UART0.transmit_sync(buf); | ||
} | ||
} | ||
} | ||
|
||
/// Panic handler | ||
#[no_mangle] | ||
#[panic_handler] | ||
pub unsafe extern "C" fn panic_fmt(info: &PanicInfo) -> ! { | ||
const LED1_PIN: PinNr = PinNr::P01_0; | ||
let led = &mut led::LedHigh::new(&mut msp432::gpio::PINS[LED1_PIN as usize]); | ||
let writer = &mut UART; | ||
|
||
debug::panic( | ||
&mut [led], | ||
writer, | ||
info, | ||
&cortexm4::support::nop, | ||
&PROCESSES, | ||
&CHIP, | ||
) | ||
} |
Oops, something went wrong.