ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
<re_irc> <Lachlan> I'm trying to figure out how to determine the size of the .text section by generating symbols in the linker script. Has anyone else done this before?
<re_irc> <dirbaio> making the binary itself know its own size?
<re_irc> <dirbaio> there's already __stext, __etext in the cmrt linker script
<re_irc> <Lachlan> Oh sick
<re_irc> <Lachlan> Yeah, that's exactly what I'm doing
<re_irc> <dirbaio> extern "C" {
<re_irc> static __etext: u8;
<re_irc> static __stext: u8;
<re_irc> }
<re_irc> <Lachlan> I'd want to include .rodata right?
<re_irc> <dirbaio> ah you want "flash image size"?
<re_irc> <Lachlan> Yes
<re_irc> <dirbaio> hmm not sure what symbol is best
<re_irc> <dirbaio> __stext..__edata maybe
<re_irc> <dirbaio> * "__stext..__edata"
<re_irc> <dirbaio> or "__stext..__veneer_limit"
<re_irc> <Lachlan> I was just thinking __veneer_limit, yeah
<re_irc> <Lachlan> Thanks, that was helpful
causal has quit [Quit: WeeChat 3.5]
<re_irc> <Lachlan> Hmm, the size isn't _quite_ right
<re_irc> <Lachlan> Looks like the linker script is rounding the size up to a multiple of 32 bytes, but the firmware binary isn't rounded up
<re_irc> <dirbaio> ahhhhh :(
<re_irc> <dirbaio> yeah... ". = ALIGN(32);" moves the "pointer" but doesn't actually write zeros
<re_irc> <Lachlan> :/
<re_irc> <dirbaio> if you're not using trustzone, sgstubs will be empty, so you can use __edata
<re_irc> <dirbaio> but it might have the same problem if the last thing in .data is not a size multiple of 4 bytes! :D
<re_irc> <dirbaio> dunno if it's possible to get the linker to zeropad
fabic has joined #rust-embedded
<re_irc> <Lachlan> I can just round separately actually
funsafe has quit [Ping timeout: 244 seconds]
funsafe has joined #rust-embedded
<re_irc> <usize> Hello all, I'm new to Rust Embedded development and I'm running into an issue which might be very simple for this group. I have a MSP432E401Y Launchpad board and I'm trying to get a simple GPIO LED toggle program using the cortex_m_quickstart (https://github.com/prabhpreet/gpio-hello). For the peripherals, I've generated a PAC using svd2rust (https://github.com/prabhpreet/msp432e401y-rs). When I run it using GDB/OpenOCD,...
<re_irc> ... on attempting a peripheral register write for GPION registers, it directs to the Hard Fault handler (image above)
<re_irc> <usize> On the openocd terminal as well, I see that it fails to read the memory where the peripheral registers are located:
<re_irc> Error: Failed to read memory at 0x40064400
<re_irc> Info : SWD DPIDR 0x2ba01477
<re_irc> Error: Failed to read memory at 0x40064504
<re_irc> <usize> Any ideas what this could be?
<re_irc> <usize> * the issue
<re_irc> <usize> +I'd appreciate any guidance on how to troubleshoot further. Apologies for the newb questions
<re_irc> <jannic> I don't know that MCU at all. Some chips can completely disable some peripherals and often they are disabled by default. Perhaps there is some bit in some other register you need to set first? Look for power and clock settings.
<re_irc> <jannic> Perhaps PCGPIO?
emerent has quit [Ping timeout: 248 seconds]
emerent has joined #rust-embedded
<re_irc> <9names (@9names:matrix.org)> i happen to have one of those boards (that I've never used), two secs while i get the TI tools installed.
<re_irc> <9names (@9names:matrix.org)> thanks for sharing the code you're using, it makes it much easier to help troubleshoot.
<re_irc> two quick things: you probably want a cargo config file in your project so that you don't have to specify a target when building:
<re_irc> [build]
<re_irc> $ cat .cargo/config
<re_irc> <9names (@9names:matrix.org)> also, the second write you do to the GPIO data register is going to clobber the first.
<re_irc> this is probably closer to what you wanted to do:
<re_irc> peripherals
<re_irc> .GPION
<re_irc> <9names (@9names:matrix.org)> * w.bits(r.bits()
<re_irc> <9names (@9names:matrix.org)> * 0x00000001
<re_irc> <9names (@9names:matrix.org)> * .modify(|r,
<re_irc> <usize> Thank you, will look into the power on registers!
<re_irc> <9names (@9names:matrix.org)> i'm assuming they do like the latter MSP430s where all the peripherals are powered off at boot?
<re_irc> <usize> Thank you, my .gitignore ignored this file, will add that to my repo in case there is an issue with the config file (I have added Cortex M4F target there)
<re_irc> <usize> You're right, I was using a C++ API when using C++ where System Peripherals do get enabled first. I will give this a try with enabling the registers they use in the API. Thank you so much for the guidance!
<re_irc> <9names (@9names:matrix.org)> it's great that XDS110 on this board supports CMSIS-DAP as well as the TI propriety protocols, so debugging this thing with probe-rs should be possible once the CMSIS pack has been imported.
<re_irc> <usize> Thank you, will keep this in mind!
<re_irc> <9names (@9names:matrix.org)> regarding the GDB errors: i seem to remember that you need to tell openocd which memory regions are allowed to be accessed. it's been a while since i've touched openocd so i might be wrong here.
<re_irc> <usize> I tried to specify the chipname manually by creating an openocd cfg file:
<re_irc> set CHIPNAME MSP432E401Y
<re_irc> source [find interface/xds110.cfg]
<re_irc> adapter speed 10000
<re_irc> <usize> I tried to specify the chipname manually by creating an openocd cfg file:
<re_irc> set CHIPNAME MSP432E401Y
<re_irc> source [find interface/xds110.cfg]
<re_irc> adapter speed 10000
<re_irc> <9names (@9names:matrix.org)> hmm, looking at the MSP432 blinky example it seems you need to write to msp432e401y_rs::sysctl::rcgcgpio::SYSCTL_RCGCGPIO_R12_W first
<re_irc> that's the clock-gating control register for GPIO portn
<re_irc> <usize> Trying that now, thanks!
<re_irc> <9names (@9names:matrix.org)> hmm, i think we've got some linker issues here. my generated elf doesn't have a main, does yours?
Amadiro__ has joined #rust-embedded
Amadiro_ has quit [Ping timeout: 240 seconds]
<re_irc> <usize> 9names: I'm not getting the hard fault after setting the clock-gating control register, and am able to see a main on expanding the [#entry] macro, stepping through the code:
<re_irc> #[export_name = "main"]
<re_irc> pub unsafe extern "C" fn __cortex_m_rt_main_trampoline() {
<re_irc> __cortex_m_rt_main()
<re_irc> <usize> * The hard fault did not occur after setting the clock-gating control register! I'm
<re_irc> <usize> Just trying to set the LED drivers and push/pull down configuration registers to see if I can get the LED to light up. Thanks 9names for your help!!!
<re_irc> <barafael> silvergasp: interesting, can you link your project?
<re_irc> <barafael> I got
<re_irc> * https://github.com/barafael/as5600-rs simple i2c driver, some bit twiddling to get the config values
<re_irc> * https://github.com/barafael/sdp8xx-rs pretty much the same, though uses type state pattern so may pose a challenge to use
<re_irc> * https://github.com/barafael/cd74hc4067-rs gpio-only driver
<re_irc> <9names (@9names:matrix.org)> usize: it's not happening with the updated version of your repo so it must be something i did
<re_irc> <usize> 9names: The PAC I have for this microcontroller is stored locally for me. Have you cloned this locally (https://github.com/prabhpreet/msp432e401y-rs) and had your Cargo.toml point to the local folder for msp432e401y-rs?
<re_irc> <9names (@9names:matrix.org)> yes, i already did that to start. first thing i did was look in your cargo.tom to work out what i needed
aspe has joined #rust-embedded
aspe has quit [Client Quit]
mrkajetanp_ has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
mrkajetanp has joined #rust-embedded
<re_irc> <9names (@9names:matrix.org)> ah. final trick is to enable digital IO mode for the pin.
<re_irc> unsafe {peripherals.GPION.den.modify(|r,w| {w.bits(r.bits() | 0x01)});}
<re_irc> <usize> Realized that, all finally lit up! :)
<re_irc> Thanks again for your help!
<re_irc> <usize> Now onto interrupts!
<re_irc> <9names (@9names:matrix.org)> good luck!
<re_irc> <9names (@9names:matrix.org)> also: congratulations on a successful board bring-up 🎉
<re_irc> <usize> 9names: Thank you!
crabbedhaloablut has quit [Read error: Connection reset by peer]
crabbedhaloablut has joined #rust-embedded
dc740 has joined #rust-embedded
starblue has quit [Ping timeout: 258 seconds]
starblue has joined #rust-embedded
fabic has quit [Ping timeout: 256 seconds]
dc740 has quit [Remote host closed the connection]
dc740 has joined #rust-embedded
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 244 seconds]
explore has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
dc740 has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
dc740 has joined #rust-embedded
funsafe has quit [Ping timeout: 248 seconds]
funsafe has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
fabic has joined #rust-embedded