#avr Logs

Dec 04 2018

#avr Calendar

08:09 AM [1]MrMobius is now known as MrMobius
11:26 AM leachim6: dumb question, what's the best way to write ASM for avr on linux?
11:26 AM leachim6: C is pretty straightforward with avr-gcc, and you can put asm blocks into it
11:27 AM leachim6: but what about pure ASM ?
11:27 AM LeoNerd: The rare times I do it, I put it in asm blocks in C
11:27 AM leachim6: yeah that seems to be the preferred way
11:27 AM LeoNerd: I have a WS2812 driver like that
11:27 AM leachim6: yeah I wanna do something similar
11:27 AM leachim6: with attiny13a
11:27 AM nohit: you can use avr-gcc for asm dev
11:27 AM nohit: http://polprog.net/blog/asm/
11:28 AM leachim6: neat, thanks for the link
11:29 AM LeoNerd: I generally find I don't want the entire program in ASM; I just sometimes need a small part of it
11:29 AM LeoNerd: Which is where inline asm blocks in gcc are fine
11:31 AM nohit: if you use avrgcc then you dont have to setup stack pointer etc init stuff so its little more convinient
11:31 AM leachim6: I'm not really versed in asm or c to be honest
11:31 AM nohit: but we used the official avr assembler at school
11:31 AM leachim6: the programs arduino IDE generates are *huge* in comparison to pure asm
11:31 AM LeoNerd: leachim6: if it'd help I could share my WS2812 driver..?
11:31 AM leachim6: and I bought a bunch of these attiny13's because they're cheap so, I figured I'd try my hand
11:31 AM nohit: yeah
11:31 AM leachim6: LeoNerd: sure I'd like to look at it :)
11:33 AM polprog: the only case where i think writing the whole progrm in assembly would be either when you cant do it in C (like the tiniest attinys without RAM) or for fun ;)
11:33 AM leachim6: it's a hobby, so it's all for fun
11:33 AM polprog: good :D
11:33 AM LeoNerd: leachim6: https://paste.debian.net/1054348/
11:34 AM LeoNerd: I unrolled the bits because I wanted lots of NOP slots, because I have a plan sometime to write a dual WS2812+DMX program, by adding the DMX driver into those NOP slots
11:34 AM polprog: jmp .+0. thats quite a neat trick
11:34 AM leachim6: I was inspired by this post -> https://jaycarlson.net/microcontrollers/
11:35 AM leachim6: anyways...I have too many uC now is my point
11:35 AM LeoNerd: polprog: it's what the <util/delay.h> macros use
11:35 AM leachim6: figured it's about time to learn how to use some of them properly without the training wheels
11:35 AM leachim6: LeoNerd: why are the newlines specified on every line?
11:36 AM LeoNerd: leachim6: because all of these strings are just concatenated together; without that they'd appear one long string to the assembler
11:37 AM leachim6: how big is this when compiled?
11:37 AM LeoNerd: Er.. unsure. It's part of a rather larger program
11:37 AM polprog: yes, the inline asm is just concatenated and fed directly to gnu as
11:37 AM leachim6: yeah I see, lots of includes
11:38 AM polprog: but most instructions take two bits iirc so thats a good measure for a ballpark figure
11:38 AM polprog: yeah all take 2 bytes*
11:38 AM polprog: bytes not bits
11:38 AM polprog: :P
11:38 AM leachim6: that'd be a neat trick
11:41 AM polprog: hmm, so attiny13 has a whole 64 bits of sram
11:41 AM polprog: bytes*
11:41 AM polprog: grr
11:41 AM nohit: write an asm driver for some simple device, that's a good starting point
11:42 AM nohit: pure asm
11:43 AM LeoNerd: avr-gcc works for ATtiny13
11:44 AM polprog: the nice thing about compiling assembly files with avr-gcc is that it produces a full executable with the interrupt vector table and stack initialized
11:44 AM nohit: i think its good idea to start with asm, even if you dont have much C experience. you get to see how microcontrollers work on the most basic level
11:45 AM leachim6: nohit: that's what I'm interested in
11:45 AM leachim6: at the base level, you're just pulling voltages low or hi in a specific order
11:45 AM leachim6: s/hi/high
11:46 AM polprog: that really then helps to understand all the abstraction that libc-avr provides
11:49 AM leachim6: I looked at PIC when I first started messing with micros a few months ago because some EE's I talked to preferred it
11:50 AM leachim6: not trying to start a flame war
11:50 AM nohit: :D
11:50 AM leachim6: but I really like how easy AVRs are to write
11:50 AM leachim6: I literally have like 20 things in my house right now that can flash an AVR
11:50 AM leachim6: and one a single one for PIC
11:50 AM leachim6: got a raspberry pi? you got an AVR programmer, arduino board? AVR programmer
11:50 AM nohit: yeah
11:51 AM leachim6: I wonder if hobbyists are keeping microchip making DIPs
11:51 AM leachim6: most other uC just simply don't come in DIP
11:51 AM polprog: im surprised that there isnt a raspi based pic flasher
11:52 AM polprog: also, SMD like SOIC isnt that hard to solder
11:52 AM polprog: or tqfp
11:52 AM LeoNerd: You can write AVR with any sort of SPI master
11:52 AM polprog: you can get a variety of breakouts or even whole modules
11:52 AM leachim6: polprog: yeah I have a bunch of adapters for everything up to TQFP-48
11:52 AM leachim6: all the way down to SOT23-3
11:52 AM polprog: wait till you start designing your own pcbs
11:52 AM polprog: ;)
11:52 AM leachim6: I've already made 2 orders to JLCPCB for other designs
11:53 AM leachim6: it was cheaper to have them made up then to buy them :D
11:53 AM polprog: thats a great journey ahead of you :D
11:53 AM leachim6: I did not design them, just ordered them
11:53 AM leachim6: but I know how to make gerber files now...
11:53 AM polprog: yeah, i tested JLC with my audio effect board, but i sent bad files
11:53 AM polprog: so i had to cut and jump the board with wires ;D
11:54 AM leachim6: the pitch on my cutaways was too wide and jlc advised that they'd break during shipping and offered to fix it for me
11:54 AM leachim6: that was cool
11:54 AM leachim6: it was probably fine either way, but still
11:54 AM leachim6: they really do look at the files
11:54 AM polprog: every boardhouse does
11:54 AM leachim6: yeah I guess they have to know whether the design is physically impossible to make
11:55 AM leachim6: I wanna try a toner transfer on copper clad, but I don't know what to make yet
11:55 AM polprog: funny enough, JLC not on the first-order-for-2-bucks promo is more expensive than my local boardhouse ;)
11:55 AM leachim6: where's local?
11:55 AM polprog: poland
11:55 AM leachim6: interesting
12:19 PM polprog: leachim6: what about you? where are you at?
11:42 PM rue_mohr: canada
11:42 PM rue_mohr: earth
11:43 PM rue_mohr: milky way
11:43 PM rue_mohr: I couldn't be farther from anything interesting
11:44 PM day__ is now known as day
11:47 PM nohit: i would like to visit canada
11:48 PM rue_mohr: I'd like to visit the moon, wanna trade?
11:48 PM rue_mohr: my ship isn't working, have to use yours