the only thing that doesn't work is the buffer, which is bad, but at least the board lights up
This commit is contained in:
parent
902379cb60
commit
d670a509a4
7 changed files with 41 additions and 53 deletions
|
|
@ -1,10 +1,9 @@
|
||||||
[build]
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||||
target = "thumbv7em-none-eabihf"
|
runner = "arm-none-eabi-gdb -q -x .gdbinit"
|
||||||
|
|
||||||
[target.thumbv7em-none-eabihf]
|
|
||||||
# Using probe-rs for flashing
|
|
||||||
runner = "probe-rs run --chip STM32F469NIx"
|
|
||||||
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C", "link-arg=-Tlink.x",
|
"-C", "link-arg=-Tlink.x",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[build]
|
||||||
|
target = "thumbv7em-none-eabihf"
|
||||||
|
|
|
||||||
2
.gdbinit
2
.gdbinit
|
|
@ -17,7 +17,7 @@ break rust_begin_unwind
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# *try* to stop at the user entry point (it might be gone due to inlining)
|
# *try* to stop at the user entry point (it might be gone due to inlining)
|
||||||
break main
|
# break main
|
||||||
|
|
||||||
monitor arm semihosting enable
|
monitor arm semihosting enable
|
||||||
|
|
||||||
|
|
|
||||||
19
build.rs
19
build.rs
|
|
@ -1,19 +0,0 @@
|
||||||
// I totally understand this and it's not copied from
|
|
||||||
// https://github.com/cyang812/rust_stm32f469i/blob/main/led_blinky/
|
|
||||||
// hehe
|
|
||||||
use std::env;
|
|
||||||
use std::fs;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
|
||||||
fs::write(out.join("memory.x"), include_bytes!("memory.x")).unwrap();
|
|
||||||
println!("cargo:rustc-link-search={}", out.display());
|
|
||||||
|
|
||||||
// Only link CCM script when the feature is enabled.
|
|
||||||
// Enable with: cargo build --features ccmram
|
|
||||||
if env::var_os("CARGO_FEATURE_CCMRAM").is_some() {
|
|
||||||
fs::write(out.join("ccmram.x"), include_bytes!("ccmram.x")).unwrap();
|
|
||||||
println!("cargo:rustc-link-arg=-Tccmram.x");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
10
ccmram.x
10
ccmram.x
|
|
@ -1,10 +0,0 @@
|
||||||
/* Extra linker script to place data into CCM SRAM */
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
.ccmram (NOLOAD) :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.ccmram .ccmram.*)
|
|
||||||
. = ALIGN(4);
|
|
||||||
} > CCMRAM
|
|
||||||
} INSERT AFTER .rodata;
|
|
||||||
10
memory.x
10
memory.x
|
|
@ -1,9 +1,7 @@
|
||||||
/* Memory layout of the STM32F469NI */
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH : ORIGIN = 0x08000000, LENGTH = 2M
|
FLASH : ORIGIN = 0x08000000, LENGTH = 2M
|
||||||
RAM : ORIGIN = 0x20000000, LENGTH = 384K
|
RAM : ORIGIN = 0x20000000, LENGTH = 320K
|
||||||
CCMRAM : ORIGIN = 0x10000000, LENGTH = 64K
|
|
||||||
SDRAM : ORIGIN = 0xC0000000, LENGTH = 16M
|
SDRAM : ORIGIN = 0xC0000000, LENGTH = 16M
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -11,8 +9,8 @@ SECTIONS
|
||||||
{
|
{
|
||||||
.sdram (NOLOAD) :
|
.sdram (NOLOAD) :
|
||||||
{
|
{
|
||||||
*(.sdram .sdram.*);
|
. = ALIGN(4);
|
||||||
|
*(.sdram)
|
||||||
|
. = ALIGN(4);
|
||||||
} >SDRAM
|
} >SDRAM
|
||||||
}
|
}
|
||||||
|
|
||||||
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
|
|
||||||
|
|
|
||||||
14
src/main.rs
14
src/main.rs
|
|
@ -10,13 +10,10 @@ use crate::hal::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use defmt_rtt as _;
|
|
||||||
use otm8009a::{Otm8009A, Otm8009AConfig};
|
use otm8009a::{Otm8009A, Otm8009AConfig};
|
||||||
use panic_probe as _;
|
use panic_halt as _;
|
||||||
use stm32f4xx_hal::{self as hal, ltdc, rcc::Config};
|
use stm32f4xx_hal::{self as hal, ltdc, rcc::Config};
|
||||||
|
|
||||||
defmt::timestamp!("{=u32}", 0u32);
|
|
||||||
|
|
||||||
const WIDTH: usize = 480;
|
const WIDTH: usize = 480;
|
||||||
const HEIGHT: usize = 800;
|
const HEIGHT: usize = 800;
|
||||||
|
|
||||||
|
|
@ -175,6 +172,7 @@ fn main() -> ! {
|
||||||
});
|
});
|
||||||
while fmc.sdsr().read().busy().bit_is_set() {}
|
while fmc.sdsr().read().busy().bit_is_set() {}
|
||||||
fmc.sdrtr().write(|w| w.count().set(1385));
|
fmc.sdrtr().write(|w| w.count().set(1385));
|
||||||
|
while fmc.sdsr().read().busy().bit_is_set() {}
|
||||||
|
|
||||||
let mut lcd_reset = gpioh.ph7.into_push_pull_output();
|
let mut lcd_reset = gpioh.ph7.into_push_pull_output();
|
||||||
lcd_reset.set_low();
|
lcd_reset.set_low();
|
||||||
|
|
@ -193,12 +191,12 @@ fn main() -> ! {
|
||||||
DISPLAY_CONFIGURATION,
|
DISPLAY_CONFIGURATION,
|
||||||
Some(hse_freq),
|
Some(hse_freq),
|
||||||
);
|
);
|
||||||
display.enable_layer(ltdc::Layer::L1);
|
|
||||||
display.config_layer(
|
display.config_layer(
|
||||||
ltdc::Layer::L1,
|
ltdc::Layer::L1,
|
||||||
unsafe { &mut BUFF[..] },
|
unsafe { &mut BUFF[..] },
|
||||||
PixelFormat::ARGB8888,
|
PixelFormat::ARGB8888,
|
||||||
);
|
);
|
||||||
|
display.enable_layer(ltdc::Layer::L1);
|
||||||
|
|
||||||
let dsi_pll_config = unsafe { DsiPllConfig::manual(125, 2, 0, 4) };
|
let dsi_pll_config = unsafe { DsiPllConfig::manual(125, 2, 0, 4) };
|
||||||
let dsi_config = DsiConfig {
|
let dsi_config = DsiConfig {
|
||||||
|
|
@ -239,7 +237,6 @@ fn main() -> ! {
|
||||||
dsi_host.enable_bus_turn_around();
|
dsi_host.enable_bus_turn_around();
|
||||||
dsi_host.set_command_mode_transmission_kind(DsiCmdModeTransmissionKind::AllInHighSpeed);
|
dsi_host.set_command_mode_transmission_kind(DsiCmdModeTransmissionKind::AllInHighSpeed);
|
||||||
dsi_host.force_rx_low_power(true);
|
dsi_host.force_rx_low_power(true);
|
||||||
dsi_host.enable_color_test();
|
|
||||||
|
|
||||||
let mut otm = Otm8009A::new();
|
let mut otm = Otm8009A::new();
|
||||||
otm.init(
|
otm.init(
|
||||||
|
|
@ -255,6 +252,11 @@ fn main() -> ! {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
(0..480 * 800).for_each(|i| BUFF[i] = 0xFF0000FF);
|
||||||
|
}
|
||||||
|
display.reload();
|
||||||
|
|
||||||
gpiog.pg6.into_push_pull_output().set_low();
|
gpiog.pg6.into_push_pull_output().set_low();
|
||||||
gpiod.pd4.into_push_pull_output().set_low();
|
gpiod.pd4.into_push_pull_output().set_low();
|
||||||
gpiod.pd5.into_push_pull_output().set_low();
|
gpiod.pd5.into_push_pull_output().set_low();
|
||||||
|
|
|
||||||
18
src/test.rs
Normal file
18
src/test.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#![no_main]
|
||||||
|
#![no_std]
|
||||||
|
use crate::hal::prelude::*;
|
||||||
|
use cortex_m_rt::entry;
|
||||||
|
use panic_halt as _;
|
||||||
|
use stm32f4xx_hal::{self as hal, rcc::Config};
|
||||||
|
|
||||||
|
#[entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
let peripherals = hal::pac::Peripherals::take().unwrap();
|
||||||
|
let mut rcc = peripherals.RCC.freeze(Config::hse(8.MHz()));
|
||||||
|
|
||||||
|
let gpiok = peripherals.GPIOK.split(&mut rcc);
|
||||||
|
let mut led = gpiok.pk3.into_push_pull_output();
|
||||||
|
led.set_low();
|
||||||
|
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue