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
_whitelogger has joined #rust-embedded
sroemer has joined #rust-embedded
edm has quit [Ping timeout: 244 seconds]
edm has joined #rust-embedded
corecode[m] has quit [Quit: Idle timeout reached: 172800s]
<t-moe[m]> I'm pretty sure there must be a solution with `global_asm!`. Because as soon as I add a `use esp_hal::prelude::*` to my code, without adding the linkerfile `linkall.x`, the linking will fail because of the missing exception handlers.
<t-moe[m]> I need something similar. A nice big linking error, preferably with a symbol name I control ( `undefinde reference to _please_add_those_damn_linkerfiles` ) ;)
<t-moe[m]> s///, s/undefinde/undefined/
<t-moe[m]> s///, s/linking/linker/, s/undefinde/undefined/
<t-moe[m]> * I'm pretty sure there must be a solution with `global_asm!`. Because as soon as I add a `use esp_hal::prelude::*` to my code, without adding the linkerfile `linkall.x`, the linking will fail because of the missing exception handlers.
<t-moe[m]> I need something similar. A nice big linker error, preferably with a symbol name I control ( `undefined reference to _please_add_those_damn_linkerfiles` ) ๐Ÿคช
diondokter[m] has joined #rust-embedded
<diondokter[m]> <t-moe[m]> "I'm pretty sure there must be..." <- Instead of global_asm, you can now also use naked functions! (New in 1.88)
<diondokter[m]> You may need to stick this in a .KEEP thingy in the linker script
<diondokter[m]> s/.//
<diondokter[m]> The reset vector is force kept, and then it will reference main in a normal embedded application. So the linker sees that main is used through the reset vector
Kaspar[m] has quit [Quit: Idle timeout reached: 172800s]
M9names[m] has quit [Quit: Idle timeout reached: 172800s]
<t-moe[m]> <diondokter[m]> "You may need to stick this in a..." <- Yes, I use KEEP already in my linker script (embedded-test.x). But the problem arises when the user does NOT include my linker script....
<t-moe[m]> Not sure why the linker decides to discard main.... ๐Ÿค”
<diondokter[m]> <t-moe[m]> "Yes, I use KEEP already in my..." <- > <@t-moe:matrix.org> Yes, I use KEEP already in my linker script (embedded-test.x). But the problem arises when the user does NOT include my linker script... (full message at <https://catircservices.org/_irc/v1/media/download/AQHmTFGBtbqyhwMIeOdLG3FCzqJqv2ZKVXhi2o7Z9_BYLbThdSP8ubBgstDUOMyJSgQcVNc-faZ6_pex3_s6Ofq_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9JbGh1WVBXU1BUd3ZTV3JDaVZQTkVET3E>)
<JamesMunns[m]> <diondokter[m]> "You may need to stick this in a..." <- specifically, I think you use `no_main`, which means "main" is not special, only `_start` (IIRC?) is. Main is only special "by convention".
<JamesMunns[m]> <diondokter[m]> "You may need to stick this in a..." <- also also you might need to make it `pub extern "C" fn ...` for it to be kept, I forget all the heuristics that go into this.
<jannic[m]> The question how to show a meaningful error message if the user forgot the linker script is still unsolved AFAIK.
AshconMohseninia has joined #rust-embedded
<AshconMohseninia> question, I'm using usb-device to implement my first class. I see this in Windows, it appears Windows asks the USB device for iSerialNumber (Index 2 in my case), but the device never replies. I checked that my classes get_string function is infact never called. I set the Serial number of the device in the UsbDevice strings function
<AshconMohseninia> Windows is asking for any Language ID (0x00) for the descriptors, I'm using StringDescriptors::default().manufacture("xxx").product("yyy").serial_number("zzz"). So why could my device not be replying
AdamHorden has joined #rust-embedded
<jason-kairos[m]> suppose you wanted to have a function that you could trigger when the debugger is attached (ie. the function only exists for that purpose)
<jason-kairos[m]> is there a good reliable way of doing that?
<jason-kairos[m]> I guess something like what rtt does, special memory regions that get polled by the program periodically?
<jason-kairos[m]> (in my case, the function I want to run is "turn on the serial port part of the program so that I can send it factory configuration commands after it has already been configured")
AdamHorden has quit [Quit: Adam Horden | adam.horden.me]
AdamHorden has joined #rust-embedded
Lumpio[m] has joined #rust-embedded
<Lumpio[m]> Ashcon Mohseninia (RAND_ASH) Language ID 0 means "return list of supported languages", not "any language ID". The standard istrings (manufacturer/product/serial_number) are directly handled by UsbDevice so your class doesn't see the requests for those via get_string (they're part of the "device", not the class)
<Lumpio[m]> s/istrings/strings/, s/serial_number/serial\_number/, s/get_string/get\_string/
<diondokter[m]> <jason-kairos[m]> "suppose you wanted to have a..." <- You can check the C_DEBUGEN bit in the DHCSR register: https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/Debug-register-support-in-the-SCS/Debug-Halting-Control-and-Status-Register--DHCSR?lang=en
<diondokter[m]> But I don't know if it's 100% reliable
<jason-kairos[m]> if I recall correctly, the reabability of C_DEBUGEN might be implementation defined, and not readable on STM32. (there was a long comment in the hubris OS kernel bemoaning the unreadability of the debug registers)
<jason-kairos[m]> * if I recall correctly, the reabability of C_DEBUGEN might be implementation defined, and not readable on STM32. (there was a long comment in the hubris OS kernel bemoaning the unreadability of the debug registers on the particular CPU they targeted)
<diondokter[m]> You could actively set a bool to true using the debugger. In the firmware you would poll it
<diondokter[m]> Well, maybe just set a number to not 0. That's less UB-prone :)
<vollbrecht[m]> instead of polling you could also just sprincle in checks to "enable" that feature, e.g when you run __start, and maybe in your panic handler. That would i think cover most of it, while not have any big overhead.
<JamesMunns[m]> Fun fact, if you set your `DEFMT_LOG` level to "INFO" and not "info", it'll just not print anything
dngrs[m] has joined #rust-embedded
<dngrs[m]> capital letters were a mistake
<thejpster[m]> Iโ€™ll take a PR to reject it at compile time
sroemer has quit [Quit: WeeChat 4.5.2]
<dngrs[m]> <thejpster[m]> "Iโ€™ll take a PR to reject it at..." <- would that go in https://github.com/knurling-rs/defmt/blob/main/macros/build.rs ?
<dngrs[m]> finding it hard to decide
<JamesMunns[m]> the issue is here: https://github.com/knurling-rs/defmt/blob/d52b9908c175497d46fc527f4f8dfd6278744f09/macros/src/function_like/log/env_filter/parse.rs#L36-L40, `parse_log_level` fails, so it tries to parse it as a module path?
<dngrs[m]> JamesMunns[m]: I was thinking "reject any value that isn't ('trace', 'debug', ...)"
<dngrs[m]> oh right, module paths
<JamesMunns[m]> you could also do that, it DOES reject it, but currently the code says "oh level parsing fails so treat it as a module path"
<dngrs[m]> that does complicate things
<JamesMunns[m]> which I guess it can't exactly tell if it is invalid or not at this point?
<dngrs[m]> hmrmm
<dngrs[m]> rock, meet hard place
<JamesMunns[m]> I wonder what would happen if you had a crate called `debug` and you tried to pass `DEFMT_LOG="debug=trace"` lol
<dngrs[m]> could use some test cases eh
<JamesMunns[m]> JamesMunns[m]: https://github.com/knurling-rs/defmt/pull/972
<vollbrecht[m]> in rust code i today hat something similar, though the compiler was "smart enough".
<vollbrecht[m]> E.g have a Enum that contains a `Error` variant. Than have a impl with a associated type Error that also uses Self::Error return types; So your return type colides with the enum variant type.
<JamesMunns[m]> JamesMunns[m]: oh no CI is failing because the new stable has new clippy lints ๐Ÿ™ƒ
<thejpster[m]> Apparently you can just tell clippy to not do that
<thejpster[m]> One for the file marked โ€œlook here when someone says no one is using Rust in productionโ€
DominicFischer[m has joined #rust-embedded
<DominicFischer[m> Does #[link_section = "..."] work (the way one would want it to work) on async functions?
<DominicFischer[m> Will the Future::poll be placed in the section I want, or will it just be the function that returns the Future?
thalesfragoso[m] has joined #rust-embedded
<thalesfragoso[m]> <DominicFischer[m> "Will the Future::poll be..." <- async fn is just sugar for a function that returns a Future, so the latter.
<DominicFischer[m> Damn, I was worried that'll be the case. Is it possible to achieve the former?
<thalesfragoso[m]> Hmm, I can't see a way using async/await.
<thalesfragoso[m]> Tbh I haven't tried the link_section on async fn, it's just what I expect to happen.
cr1901_ has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded