#avr Logs

Nov 14 2017

#avr Calendar

08:09 AM robinak is now known as robink
10:05 AM anonnumberanon is now known as logstaren
12:01 PM Ameisen: Just so you guys know - I've found that gcc is not particularly smart when it comes to inlining for AVR
12:01 PM Ameisen: I use -finline-limit=10000000, which gives me smaller binaries
12:01 PM Ameisen: Ideally, it should inline any function where inlining it would result in smaller or equivalently-sized binaries
12:02 PM Ameisen: it doesn't seem to do that - I'm guessing it's still relying on internal code for handling cache locality
12:13 PM Emil: Hmm
12:13 PM Emil: Opinions:
12:14 PM Emil: Using literals/constant vs variables that you know/can guarantee holds the wanted value?
12:14 PM Emil: Ameisen: what about perf?
12:14 PM Jartza: hmmh
12:14 PM Jartza: http://www.plzi.com/koodia/l-lander.asp
12:15 PM Jartza: any other octapentaveegas "in production"? :)
12:16 PM Ameisen: Emil - haven't tested performance, but I can almost guarantee the performance is better.
12:16 PM Ameisen: Emil - in what context
12:16 PM Ameisen: in C++, I use constexpr for most things.
12:16 PM Ameisen: if it's C, I have very little opinion.
12:16 PM Emil: Ameisen: performance is better with which one
12:16 PM Ameisen: and I'm not too familiar with C programming practices.
12:16 PM Ameisen: Emil - more inlining, obviously
12:16 PM Emil: ah
12:16 PM Ameisen: fewer function calls, easier to optimize register allocation
12:16 PM Emil: I thought you answered my question :D
12:17 PM Ameisen: oh, for your question, doubt it matters
12:17 PM Ameisen: a sane C or C++ compiler will know that a variable, a literal, or a constant don't change
12:17 PM Ameisen: C++ just gives you constexpr which enforces that.
12:17 PM Ameisen: C has no good equivalent
12:17 PM Emil: yeah but I mean
12:17 PM Emil: if it's a silly compiler
12:17 PM Ameisen: a stupid compiler will always generate stupid code
12:17 PM Emil: the variable needs to be first ldi'd into a register
12:17 PM Ameisen: a sane one (gcc, clang, msvc) will do fine
12:17 PM Emil: and then I can use that register
12:18 PM Ameisen: well, not clang on avr
12:18 PM Emil: but if it's a variable the compiler knows to keep int in a register
12:18 PM Ameisen: clang's avr implementation still sucks
12:18 PM Ameisen: but I'm workong on that
12:18 PM Emil: Ameisen: you can't trust GCC, either :D
12:18 PM Ameisen: it doesn't always have to be ldi'd
12:18 PM Ameisen: think true constant expressions
12:18 PM Ameisen: the compiler is pretty good at rolling code so it can elide expressions altogether
12:19 PM Ameisen: I always enjoy it figuring out that a variable can never be larger than the value '8', and since there's an if (var > 8) somewwhere, it elides everything in that branch
12:19 PM Ameisen: C++ makes it more explicit, but a C compiler will do that as well if it has enough context.
01:19 PM Ameisen: is the avr libm still faster than using the default gcc libs?
01:56 PM Emil: probably
01:56 PM Emil: though benchmarking should be easy
05:47 PM nuxil: man. i messed up my fuses on my ainty85..
05:47 PM nuxil: :(
05:47 PM nuxil: *atiny
05:47 PM nuxil: time to make a hv programmer i guess.
05:47 PM Tom_L: dragon will hvpp
05:48 PM Tom_L: it's a pita any way you look at it
05:48 PM nuxil: i just have 1 question tho.
05:49 PM nuxil: when i want to reset the fuses.. i just do avrdude bla bla -U lfuse:w:0x62:m -U hfuse:w:0xdf:m right ?
05:49 PM LeoNerd: I sell HV programmers for ATtinys
05:49 PM LeoNerd: Well, 8 or 14pin ones anyway
05:49 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/how_to/atmega168/using_avrdude_index.php
05:49 PM Tom_L: shameless plug there :D
05:50 PM nuxil: alright.
05:50 PM Tom_L: i had one for tiny 4 5 9 10 etc
05:50 PM nuxil: LeoNerd, how much ?
05:50 PM Tom_L: worth 2x that now that you _NEED_ one
05:50 PM nuxil: lol
05:51 PM LeoNerd: nuxil: https://www.tindie.com/products/leonerd/avr-hvsp-programming-bus-pirate-adapter/
05:51 PM Tom_L: even with the fancy sockets!
05:51 PM Tom_L: and fancy oshkosh board!!!
05:52 PM nuxil: LeoNerd, that looks like a nice little gadget. expensive tho imo. its almost 300 Norwegian krones. then comes shipping at 50kr :p
05:52 PM LeoNerd: Ah, but it's all hand-crafted
05:52 PM LeoNerd: Lovingly-so, if I do say so myself ;)
05:53 PM Tom_L: pfft. i put blood sweat and tears into mine
05:53 PM Tom_L: :)
05:53 PM Tom_L: nuxil i'd cut my losses and get another chip
05:53 PM LeoNerd: Yes I'll admit it's not cheap. Those sockets are the main cost
05:53 PM Tom_L: i know
05:53 PM LeoNerd: Hmm. I suppose maybe I could sell a variant with normal DIP sockets on
05:53 PM Tom_L: you should
05:54 PM LeoNerd: I don't think I have any spare boards currently
05:54 PM Tom_L: i use sipp sockets sometimes for dip
05:54 PM LeoNerd: In any case there's really not much to it. It's mostly just a 5->12V chargepump and a controller switch for it
05:55 PM nuxil: Tom_L, well i have the parts i need to make one. except a board to put it on. i can make a tmp one on the breadboard tho.
05:55 PM Tom_L: i forget what chip i used for the pump now
05:55 PM Tom_L: some chip designed for programming rom or something
05:55 PM Tom_L: i forget
05:55 PM LeoNerd: There's a something662 which is really expensive. I use the LTC1262 which is a cheap clone
05:56 PM Tom_L: they were a buck seventy when i got mine
05:57 PM Tom_L: ST992ACD-TR
05:57 PM nuxil: LeoNerd, thouse sockets on your hvsp must up the price a lot
05:57 PM LeoNerd: I just said that
05:57 PM Tom_L: sp/99/66
05:57 PM nuxil: oh
05:57 PM LeoNerd: 23:53 <LeoNerd> Yes I'll admit it's not cheap. Those sockets are the main cost
05:57 PM nuxil: missed it
05:58 PM LeoNerd: If you've got a 12V supply and a couple of transistors, you can just breadboard the thing up if you need one
05:58 PM LeoNerd: That's what I did for a while
05:58 PM Tom_L: https://www.digikey.com/products/en?keywords=ST662ACD-TR
05:58 PM LeoNerd: I just like mentioning this particular product since it's the reason I got into OSHpark board fab and Tindie selling in the first place
05:58 PM nuxil: i got 50 bc537. maybe 2k resistors of variouse types :p and tonz of other crap :p
05:59 PM nuxil: i think im set for a hvsp
05:59 PM nuxil: :p
05:59 PM nuxil: *bc547
05:59 PM LeoNerd: You'll be needing a PNP as well since you need to high-side switch it
05:59 PM nuxil: i got that too.
05:59 PM LeoNerd: Well then you should be set
06:01 PM nuxil: why a pnp ? the examples i see only use 1 npn
06:01 PM nuxil: example https://cdn.instructables.com/FXU/CBOW/ISCBWXO2/FXUCBOWISCBWXO2.MEDIUM.gif
06:01 PM nuxil: https://github.com/tsaarni/avr-high-voltage-serial-programming
06:01 PM nuxil: there too
06:01 PM LeoNerd: Ah, hrm...
06:02 PM LeoNerd: Yeah I wasn't sure how much current it'd want to pull so I didn't want to do it that way
06:02 PM LeoNerd: That arrangement only works if there's basically no load on it
06:02 PM LeoNerd: Also the logic is backwards - I like power management controls to be active-high
06:03 PM LeoNerd: Hrm. Though I guess I ought to make that configurable in Device::Chip::AVR_HVSP
06:06 PM nuxil: if you guys see some smoke soon.. you know its just me burning my atiny :p
06:06 PM LeoNerd: Bet you can't put an entire MW through it ;)
06:07 PM Tom_L: if you're gonna smoke it, you need the whole fireworks effect...
06:07 PM LeoNerd: Mmm.. powdered copper
08:18 PM day__ is now known as daey
09:17 PM nuxil: no smoke :D
09:19 PM nuxil: made myself a permanent solution, so now my selfmade atiny85 programmer have normal mode and hvsp :D
09:26 PM _ami_: nice
09:26 PM _ami_: hvsp, i plan to make it in future.
09:26 PM _ami_: no time these days
09:38 PM nuxil: yea i learnt the hard way that its handy to have one.
09:39 PM cehteh: i once fucked up a tiny and just tossed it away
09:39 PM cehteh: thats cheaper and simpler than having a hvsp :D
09:41 PM nuxil: that depends
09:42 PM cehteh: yes .. in how careless you are and how many tinys you fuck up
09:42 PM nuxil: if you plan on messing alot with the tinys and are a idiot (like me) that always messes up the fuses. it could be more economic to get or make a hvsp in the long run :p
09:42 PM cehteh: how do you program the fuses?
09:42 PM nuxil: i mean set them wrong
09:42 PM cehteh: i just have a Makefile target for that
09:43 PM nuxil: yea. thats 1 lesson 1 also learnt..
09:43 PM nuxil: dont download stuff and assume it will work.. check the Makefile 1st :p
09:45 PM nuxil: what do you mean how i program fuses ?
09:46 PM JanC is now known as Guest79400
09:49 PM nuxil: to change the fuse i just do:
09:49 PM nuxil: sudo gpio -g write 22 1 ; sudo avrdude -F -p t85 -P /dev/spidev0.0 -c linuxspi -b 1000 -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
09:54 PM cehteh: why sudo?
09:54 PM cehteh: add proper permissions, groups and udev rules then you dont need sudo
09:55 PM cehteh: ls -l /dev/spidev0.0 gives what group on your installation? dialout?
09:56 PM nuxil: pi
09:56 PM cehteh: and you are logged in as pi? or made another user account?
09:57 PM nuxil: i am pi
09:57 PM cehteh: then you shouldnt need sudo for avrdude
09:57 PM cehteh: dunno about the 'gpio' command but that could certaily be configured to work without sudo as well
10:03 PM JanC_ is now known as JanC
10:25 PM JanC_ is now known as JanC
10:38 PM JanC is now known as Guest67213
10:38 PM JanC__ is now known as JanC
10:43 PM JanC__ is now known as JanC
10:43 PM _ami_: nuxil, have proper udev rules - saves lot of time
11:06 PM day__ is now known as daey