initial commit
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
commit
c6b4fa4646
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "blackmagic"]
|
||||||
|
path = blackmagic
|
||||||
|
url = https://github.com/blackmagic-debug/blackmagic.git
|
25
Cargo.lock
generated
Normal file
25
Cargo.lock
generated
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "blackmagic-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.83"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.149"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "blackmagic-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cc = "1"
|
1
blackmagic
Submodule
1
blackmagic
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 41bce050ea2cb44bae509b6ccd9daf9c59b569e3
|
56
build.rs
Normal file
56
build.rs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
fn main() {
|
||||||
|
cc::Build::new()
|
||||||
|
.files(&[
|
||||||
|
"blackmagic/src/crc32.c",
|
||||||
|
"blackmagic/src/target/adiv5_jtag.c",
|
||||||
|
"blackmagic/src/target/adiv5_swd.c",
|
||||||
|
"blackmagic/src/target/adiv5.c",
|
||||||
|
"blackmagic/src/target/ch32f1.c",
|
||||||
|
"blackmagic/src/target/cortex.c",
|
||||||
|
"blackmagic/src/target/cortexa.c",
|
||||||
|
"blackmagic/src/target/cortexm.c",
|
||||||
|
"blackmagic/src/target/efm32.c",
|
||||||
|
"blackmagic/src/target/gdb_reg.c",
|
||||||
|
"blackmagic/src/target/hc32l110.c",
|
||||||
|
"blackmagic/src/target/imxrt.c",
|
||||||
|
"blackmagic/src/target/jtag_devs.c",
|
||||||
|
"blackmagic/src/target/jtag_scan.c",
|
||||||
|
"blackmagic/src/target/kinetis.c",
|
||||||
|
"blackmagic/src/target/lmi.c",
|
||||||
|
"blackmagic/src/target/lpc11xx.c",
|
||||||
|
"blackmagic/src/target/lpc15xx.c",
|
||||||
|
"blackmagic/src/target/lpc17xx.c",
|
||||||
|
"blackmagic/src/target/lpc40xx.c",
|
||||||
|
"blackmagic/src/target/lpc43xx.c",
|
||||||
|
"blackmagic/src/target/lpc546xx.c",
|
||||||
|
"blackmagic/src/target/lpc55xx.c",
|
||||||
|
"blackmagic/src/target/lpc_common.c",
|
||||||
|
"blackmagic/src/target/msp432e4.c",
|
||||||
|
"blackmagic/src/target/msp432p4.c",
|
||||||
|
"blackmagic/src/target/nrf51.c",
|
||||||
|
"blackmagic/src/target/nrf91.c",
|
||||||
|
"blackmagic/src/target/nxpke04.c",
|
||||||
|
"blackmagic/src/target/renesas.c",
|
||||||
|
"blackmagic/src/target/rp.c",
|
||||||
|
"blackmagic/src/target/sam3x.c",
|
||||||
|
"blackmagic/src/target/sam4l.c",
|
||||||
|
"blackmagic/src/target/samd.c",
|
||||||
|
"blackmagic/src/target/samx5x.c",
|
||||||
|
"blackmagic/src/target/sfdp.c",
|
||||||
|
"blackmagic/src/target/spi.c",
|
||||||
|
"blackmagic/src/target/stm32f1.c",
|
||||||
|
"blackmagic/src/target/stm32f4.c",
|
||||||
|
"blackmagic/src/target/stm32g0.c",
|
||||||
|
"blackmagic/src/target/stm32h5.c",
|
||||||
|
"blackmagic/src/target/stm32h7.c",
|
||||||
|
"blackmagic/src/target/stm32l0.c",
|
||||||
|
"blackmagic/src/target/stm32l4.c",
|
||||||
|
"blackmagic/src/target/stm32mp15.c",
|
||||||
|
"blackmagic/src/target/target.c",
|
||||||
|
"blackmagic/src/target/target_flash.c",
|
||||||
|
"blackmagic/src/target/target_probe.c",
|
||||||
|
])
|
||||||
|
.includes(&["include/", "blackmagic/src/include/"])
|
||||||
|
.define("PC_HOSTED", Some("0"))
|
||||||
|
.compile("blackmagic");
|
||||||
|
}
|
29
include/gdb_if.h
Normal file
29
include/gdb_if.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Black Magic Debug project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Black Sphere Technologies Ltd.
|
||||||
|
* Written by Gareth McMullin <gareth@blacksphere.co.nz>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GDB_IF_H
|
||||||
|
#define __GDB_IF_H
|
||||||
|
|
||||||
|
int gdb_if_init(void);
|
||||||
|
unsigned char gdb_if_getchar(void);
|
||||||
|
unsigned char gdb_if_getchar_to(int timeout);
|
||||||
|
void gdb_if_putchar(unsigned char c, int flush);
|
||||||
|
|
||||||
|
#endif
|
18
include/general.h
Normal file
18
include/general.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#undef _GNU_SOURCE
|
||||||
|
#include_next <general.h>
|
||||||
|
|
||||||
|
#ifndef __BLACKMAGIC_SYS_GENERAL_H
|
||||||
|
#define __BLACKMAGIC_SYS_GENERAL_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// #define PRINT_NOOP() do {} while(0)
|
||||||
|
// #define DEBUG_WARN(x, ...) PRINT_NOOP()
|
||||||
|
// #define DEBUG_ERROR(x, ...) PRINT_NOOP()
|
||||||
|
// #define DEBUG_INFO(x, ...) PRINT_NOOP()
|
||||||
|
// #define DEBUG_GDB(x, ...) PRINT_NOOP()
|
||||||
|
// #define DEBUG_TARGET(x, ...) PRINT_NOOP()
|
||||||
|
|
||||||
|
#endif /* __BLACKMAGIC_SYS_GENERAL_H */
|
38
include/platform.h
Normal file
38
include/platform.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef __BLACKMAGIC_SYS_PLATFORM_H
|
||||||
|
#define __BLACKMAGIC_SYS_PLATFORM_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define SWDIO_MODE_FLOAT() \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define SWDIO_MODE_DRIVE() \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define TMS_SET_MODE() \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define TMS_PIN 1
|
||||||
|
#define TCK_PIN 2
|
||||||
|
#define TDI_PIN 3
|
||||||
|
#define TDO_PIN 4
|
||||||
|
|
||||||
|
#define SWDIO_PIN 5
|
||||||
|
#define SWCLK_PIN 6
|
||||||
|
#define SRST_PIN 7
|
||||||
|
|
||||||
|
#define SWCLK_PORT 0
|
||||||
|
#define SWDIO_PORT 0
|
||||||
|
|
||||||
|
#define gpio_set(port, pin)
|
||||||
|
#define gpio_clear(port, pin)
|
||||||
|
#define gpio_get(port, pin) 0
|
||||||
|
#define gpio_set_val(port, pin, value)
|
||||||
|
|
||||||
|
#endif /* __BLACKMAGIC_SYS_PLATFORM_H */
|
3
include/target.h
Normal file
3
include/target.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#ifndef __BLACKMAGIC_SYS_TARGET_H
|
||||||
|
#define __BLACKMAGIC_SYS_TARGET_H
|
||||||
|
#endif /* __BLACKMAGIC_SYS_TARGET_H */
|
3
src/main.rs
Normal file
3
src/main.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user