19 Jul 2020 |
adamgreig | and a lot of peripherals are almost identical across families | 18:15:25 |
adamgreig | and there's so many families - F0/1/2/3/4/7 L0/1/4/5 H7 G0/4 - that maintaining a large HAL for each of them would be so much work | 18:15:56 |
adamgreig | but it does seem like what a "good HAL design" looks like is still very in flux, so I think it makes sense to keep developing them a bit separately while we work that out at least | 18:16:18 |
therealprof | In reply to @adamgreig:matrix.org I don't think that fundamentally you can't have a more unified HAL, other projects (FreeRTOS, ChibiOS, libopencm3) manage it in various ways I don't think that counts at all. They way they're achieving that is completely unacceptable in a Rust world. | 18:17:01 |
adamgreig | it's not that different from feature gates and submodules and stuff | 18:17:56 |
adamgreig | you could definitely have a HAL that had like three SPI sub-modules and exported one or the other as "SPI" based on your selected device | 18:18:24 |
adamgreig | rather than having to copy-paste that sub-module into the 4 families to which it applies, etc | 18:18:32 |
therealprof | Hiding everything in unwieldy structures and callbacks every device specific impl has to implement? Then the totally unsafe reacharound into global registers? | 18:19:00 |
therealprof | I agree we can do some stuff more globally. But there'll always be a lot model specific setup. | 18:19:55 |
adamgreig | I don't want the weird structures and callbacks and so forth, no, but I don't think they're required | 18:20:17 |
adamgreig | anyway my point for now is I think more work is useful just to discover what a good HAL contains | 18:20:31 |
therealprof | Even if the peripheral is the same, the way the peripheral is embedded into an MCU sometimes very specific. | 18:20:45 |
adamgreig | the PREC thing in H7 for example seems very neat | 18:21:09 |
adamgreig | therealprof: sure, but that's true even inside the same family | 18:21:30 |
therealprof | What's that? | 18:21:31 |
adamgreig | so you have to handle it anyway, such is the nature of embedded devices | 18:22:00 |
therealprof | * Even if the peripheral is the same, the way the peripheral is embedded into an MCU is sometimes very specific. | 18:22:22 |
therealprof | In reply to @adamgreig:matrix.org therealprof: sure, but that's true even inside the same family Yes, that's exactly what I'm saying. But there it is managable at least. | 18:22:26 |
therealprof | E.g. in order to make this work you'd have to fully abstract over the possible ways to clock a peripheral. | 18:23:12 |
mindtree | huh, I rewrote the setup function using the svd generated register api thing and now it seems to be working (doesn't hang anymore at least)! I wonder if maybe one of these hand-written register addresses is wrong or something like this | 18:23:46 |
therealprof | It is possible to forget about these things with e.g. USB and ETH where you can forget about the details because the clocks are fixed prerequisites. | 18:24:01 |
therealprof | That's makes an abstraction vastly easier. | 18:24:20 |
mindtree | * huh, I rewrote the setup function using the svd generated register api thing and now it seems to be working (doesn't hang anymore at least)! I wonder if maybe one of these hand-written register addresses in the setup::setup() function is wrong or something along these lines | 18:27:42 |
thalesfragoso | In reply to @mindtree:matrix.org huh, I rewrote the setup function using the svd generated register api thing and now it seems to be working (doesn't hang anymore at least)! I wonder if maybe one of these hand-written register addresses is wrong or something like this Hmm, you mean the bb stuff ? I tried on a F407 though .-. | 18:33:02 |
thalesfragoso | And I also looked at all manuals to see if they were the same | 18:33:27 |
mindtree | Yeah, if I can confirm the ethernet works I'll do up a PR and get your thoughts on it | 18:34:00 |
thalesfragoso | Hmm, but it would be a bumper if we would need to get rid of the bb | 18:34:34 |
mindtree | oh really? why's that? | 18:35:02 |
mindtree | I was imagining these generated write and read methods might compile down to that under the hood, but I haven't looked closesly at that at all | 18:35:38 |
thalesfragoso | Bit banding guarantees atomic acesses | 18:36:21 |