#avr Logs

Mar 22 2021

#avr Calendar

06:32 AM exp: so yes, after yesterdays experiments, it was the shifting left by 9 that's an issue, i haven't decoded the asm generated yet, but it fills the upper 2 bytes of the u32 with 1s
06:39 AM exp: unsurprisingly going over the boot boundary by quite some way!
06:39 AM exp: doing an intermediary step of assigning the received char to a u32 before shifting in resolves the issue, but i still need to learn the asm to know exactly what's going wrong
07:50 AM jancoow: Exp what you working on?
07:50 AM exp: jancoow: https://github.com/abcminiuser/lufa/pull/170
07:50 AM exp: resolved now thankfully
07:51 AM exp: alternate answer: getting my blood pressure back down :-)
07:53 AM twnqx: so i wasn't wrong with blaming avr-gcc
07:53 AM exp: twnqx: indeed, apparently this is one of the hairier areas of C, the promotion of datatypes
07:54 AM twnqx: i would recommend you post the example, trivilizied down with e.g. a function doing only the math and one calling it, to demonstrate the issue and mail it to the avr-gcc mailing list. they can judge if avr-gcc is wrong, or the code was wrong
07:54 AM twnqx: i had a similar promotion issue fixed within a day
07:54 AM exp: I have that + produced asm in a text file, but I'll get to that some point down the line
07:54 AM exp: compiler devs are notoriously exacting in their requirements
07:55 AM twnqx: i did not have that experience
07:55 AM exp: I could still be a fool and the error is something entirely different, but the generated asm for the prior case I simply do not understand
07:55 AM exp: wheras after the cast it's quite clear it populates all 4 bytes and loops to do the shift, rather than tries to statically assign it and then double the value
07:55 AM twnqx: mh
07:55 AM twnqx: actually
07:56 AM twnqx: overflow through shifting is undefined behavior in C
07:56 AM exp: well that would explain the nonsensical asm like `eor r18, r18`
07:56 AM twnqx: looking at your diff, it might actually be expected behavior
07:56 AM twnqx: eh, that's just a faster "load r18 with 0"
07:57 AM twnqx: or smallert
07:57 AM exp: it uses it in an `or` later, without change
07:57 AM exp: that's what my friend said, but is that true in avr?
07:57 AM twnqx: xor X,X is always 0
07:57 AM exp: ldi 0x00 appears elsewhere in the code
07:57 AM exp: sure, but is it smaller? it doesn't seem to be, maybe it's faster
07:57 AM twnqx: i would expect it to be smaller
07:58 AM twnqx: you should be able to see in an avr-objdump disassembly :P
07:58 AM exp: well, this is where i defer to expertise in fear of looking a fool
07:58 AM exp: yeah i did, and it seemed the same, hence i am retreating rapidly :D
07:58 AM twnqx: i actually don't know, i am using asm veeeeery rarely
07:58 AM exp: anyhow, i can now reliably flash over 32k with the bootloader size check in place, and am free to set my lock bits
07:58 AM exp: which is all i wanted on friday, so I think that's good going
07:59 AM exp: now if only my colleague would read his damn messages
07:59 AM twnqx: and i only do in cases where every cycle matters :P
07:59 AM twnqx: or where C just can't handle it, which usually is the lowest of levels
07:59 AM exp: yes thanks to AVR I have finally begun to understand the core of an operating system
08:00 AM exp: which is a level i had not explored previously
08:00 AM exp: so I look forward to that with the same sense of terror BASE jumpers must feel
08:00 AM twnqx: so, curiosity?
08:01 AM twnqx: though at the moment i rather look with annoyance at a certain aspect of the linux kernel.
08:01 AM exp: curiosity but trepidation, the diving down doesn't scare me, but it's what's at the bottom that does :-)
08:01 AM twnqx: at the bottom, there's an interrupt handler that saves and loads registers :P
08:02 AM twnqx: aka a scheduler
08:02 AM exp: sure, i've written a few schedulers before, none that had to care directly about execution context
08:03 AM exp: but it's the more complex higher order stuff built on it I fear
08:03 AM exp: for example, I want to have my tasks be interruptible, but if I'm using the TWI peripheral I could easily get that into a bad state
08:03 AM exp: so now I have to write a proper state machine to know how to deconfigure and reconfigure, or not interrupt in certain segments etc etc
08:03 AM exp: these are not questions with simple, correct answers, but tradeoffs where the cost may be known only years later
08:04 AM exp: in my personal life, one of the things i wish to build is a language to describe the tradeoffs and choices that i make as i design any system, so that i can track and account for them when i come to integrate or refactor and I have lost my prior mental context
08:15 AM twnqx: it's called // XXX:
10:34 AM exp: twnqx: unironically that, but with structure
10:34 AM twnqx: i have a project that is full of these
10:35 AM exp: yeah everything I write is littered with // TODO:
10:35 AM twnqx: and whenever i have spare time in this project i go through them and try to get rid of some
10:35 AM cehteh: make that //TODO: without space
10:35 AM exp: but i'd like to have a way to describe the semantics of code i'm writing, and hook that up to a descriptive language
10:35 AM twnqx: at 3:30 last morning i got another one done!
10:35 AM twnqx: there's TODO and XXX for me
10:35 AM cehteh: because then you can use my doc extractor to generate a list of issues :)
10:36 AM twnqx: TODO means i have an idea what to do, XXX is i know somethnig needs to be done, but no plan/idea how yet
10:36 AM exp: cehteh: yeah I've found that useful, but I want more structure, everything short of turing completeness in fact
10:36 AM cehteh: i have WIP TODO FIXME and PLANNED usually
10:36 AM cehteh: exp: https://git.pipapo.org/?p=pipadoc;a=blob_plain;f=pipadoc.html;hb=refs/heads/master
10:37 AM cehteh: that document itself is generated from the source by pipadoc itself btw
10:38 AM cehteh: https://public.pipapo.org/pipadoc_issues.html thats some older 'issues' extracted
01:16 PM jancoow: exp dang it, I think I was sleeping yesterday, the master recognise a device for the first time on my address, but the bus is failing afterwards
01:16 PM jancoow: I think it has to do what you told me yesterday..
01:18 PM jancoow: so it acknowledges the address, but it messes up the bus afterwards
01:19 PM jancoow: exp so what is that SDA hold time eaactly and do I need to set it?
01:38 PM exp: jancoow: i'm not sure, I don't have much time to help tonight i'm afraid but I will try once I have finished building my boards
01:38 PM exp: cehteh: that looks like a good tool, i am a big fan of doxygen/godoc/etc
01:39 PM cehteh: i created it becasue i dont like doxygen :D
01:40 PM cehteh: doxygen is a code browser with some annotations
01:40 PM cehteh: but not really nice documentation
01:45 PM exp: godoc is quite similar, raku goes a bit further
01:45 PM exp: but personally i think there's a whole programming-esque language that belongs there
03:08 PM jancoow: exp oh sorry, feel free to help if you are willing to or if you have time
03:09 PM jancoow: I'll give myself to figure out how to get the ice debugger to work in vscode
03:09 PM jancoow: ;p
03:50 PM jancoow: okay it clearly doesn't send an acknoledge back https://es.jancokock.me/886a5/
03:50 PM jancoow: but it keeps the bus low afterwards
04:33 PM jancoow: ugh found the issue.. the generated example code simply has a bug or something
04:33 PM jancoow: But I don't fully understand it either
04:56 PM jancoow: exp beautiful! https://es.jancokock.me/b212f/
05:03 PM exp: jancoow: congratulations
05:03 PM exp: i have just put my board in the oven
05:03 PM exp: well, first panel of 3, then i have some hand soldering to do
05:08 PM jancoow: nice!
05:08 PM jancoow: baking time :D
05:08 PM jancoow: I just learned at work that you can do that with a hot iron
05:08 PM jancoow: I might want to try that soon too
10:58 PM rue_mohr: it cant send an ack
10:58 PM rue_mohr: the line is low
10:58 PM rue_mohr: ack is done by pulling the line low
10:59 PM rue_mohr: if its already low, you cant do that
10:59 PM rue_mohr: huh k