#avr | Logs for 2013-07-01

Back
[02:18:11] <fiveofoh> I'm working with some inline assembly and have read up on how to pass data between C and the inline statements with reserved registers, but I'm not clear on...the scope, I guess, of those reservations?
[02:19:05] <fiveofoh> I have several inline assembly blocks interspersed with some C code (ifs, mostly), and I'd like to load a register at the beginning of the branching and have it available below to use
[03:12:52] <specing> fiveofoh: "register uint8_t scratch;"?
[03:13:32] <fiveofoh> Ooh, you can declare registers?
[03:13:44] <fiveofoh> Or rather, declare variables as registers?
[03:13:55] <specing> yes, sure
[03:14:15] <Roklobsta> specing: being gcc I know it hurts you to pass this helpful information on.
[03:14:52] <specing> Roklobsta: arm-gcc is sane enough for me ;D
[03:15:12] <Roklobsta> The avr-gcc monkeys must be whipped harder
[03:15:41] <specing> there are none, that is the problem
[03:16:11] <Roklobsta> abcmini said there were some guys in Norway and India who work on it.
[03:16:59] <specing> right.
[03:17:25] <specing> doesen't look like it
[03:20:45] <fiveofoh> Cool, so that will keep the register consistent within the scope, and I can just pick a register? Docs I'm seeing recommend r2-r7
[03:21:11] <fiveofoh> I've done assembly (albeit not for a while) and plenty of c/++, but this hybrid stuff is pretty new to me
[03:21:37] * fiveofoh peeks at his newly-generated assembly
[03:22:11] <Roklobsta> hybrid gooood
[03:22:41] <fiveofoh> Oh, so nice and consistent :D
[03:23:28] <fiveofoh> Thanks. I just get scared of picking specific registers because I don't want to clobber anything, but I suppose avoiding that is the compiler's job in this case
[03:23:36] <Roklobsta> although, unless you need to do things like POP and PUSH or SLEEP you might be better off just using inline functions or functions defined with #define so they get incorporated at compile time and optimised properly.
[03:24:11] <specing> fiveofoh: then don't pick them?
[03:24:21] <specing> fiveofoh: the compiler will do so on its own
[03:24:33] <Roklobsta> yeah, gcc will screw it up better than you could do.
[03:24:41] <Roklobsta> right specing?
[03:24:42] <fiveofoh> Can I reference them by name in the asm? I tried the %[varname] syntax with no luck
[03:25:16] <Roklobsta> why do you need asm?
[03:25:39] <specing> fiveofoh: if you want to use this register in interrupts *only*, and you *dont* sei() in them, then you can declare a scratch register outside the handlers and it will save one push and one pop (32 bytes of flash, 4 cycles)
[03:26:24] <Roklobsta> yeah gcc is smart enough to only push and pop what it needs to. unlike some other compilers i have used
[03:27:17] <fiveofoh> I need asm because I'm doing some bitbanging with cycle counts and nops as timing (so yes, interrupts are off)
[03:27:57] <fiveofoh> And I'm modifying existing code, but it seems like a good reason to me
[03:28:15] <Roklobsta> ok.
[03:28:18] <Roklobsta> fair enough
[03:28:38] <Roklobsta> some sort of serialiser/deserialiser?
[03:28:42] <fiveofoh> So I can take as much time as I want outside of the actual bitbanging, hence pre-loading the registers
[03:28:53] <fiveofoh> Communicating with an N64 controller, actually
[03:29:04] <fiveofoh> It's a one-line bidirectional system
[03:29:12] <Roklobsta> bitty bang bang
[03:29:21] <fiveofoh> Up, nop nop nop, down, nop nop nop
[03:29:28] <fiveofoh> 3us 1us, 1us 3us
[03:29:40] <fiveofoh> *µs
[03:29:45] <Roklobsta> ok
[03:29:55] * fiveofoh just remembered I have the compose key all set up
[03:30:34] <fiveofoh> Thanks for the help, my assembly is much more consistent now
[03:31:11] <fiveofoh> Getting it actually working as a whole is a quest for another day, this is just the block I couldn't figure out
[03:38:28] <specing> Now this is what I like: https://en.wikipedia.org/wiki/Ada_(programming_language)#Data_types
[03:42:37] <R0b0t1> ._.
[03:43:14] <Roklobsta> hrm, Ada was taught to us at uni in 1992 as it was the Next Big Thing. When the US DoD dropped the mandate for Ada Everywhere it all fizzed out.
[03:43:41] <Roklobsta> is there Ada for avr with gcc?
[03:44:56] <Roklobsta> i recall ada was super strict about everything. no silence when do you things like mix char and int with gcc.
[05:06:34] <Badaboom> Morning
[05:08:01] <Roklobsta> PRAWNS
[05:08:08] <Badaboom> Shrimp
[05:10:31] <Badaboom> https://plus.google.com/115864407908235913702/photos?hl=en&socfid=web:lu:kp:placepageimage&socpid=1#115864407908235913702/photos/photo/5762357013334376194
[05:40:34] <beaky> hello
[05:40:44] <beaky> what parts of C should I avoid to write efficient avr code
[05:47:43] <specing> C itself.
[05:48:35] <Badaboom> lol..ok coffee almost went thru my nose
[05:49:53] <specing> That is a rather long way to spell "lol"
[05:50:49] <braincracker> h
[05:53:06] <beaky> lol
[05:53:51] <beaky> I want to convert integers to ascii string
[05:53:56] <beaky> sprintf came to mind
[05:54:01] <twnqx> no you don't, strings are bad
[05:54:03] <beaky> but it might bloat my object file
[05:54:05] <beaky> ah :(
[05:54:09] <twnqx> :P
[05:54:12] <beaky> I wanna print stuff on an LCD
[05:54:15] <twnqx> snprintf if anything
[05:54:18] <twnqx> (that's what i use)
[05:54:25] <beaky> yeah snprintf is awesome
[05:54:42] <twnqx> yes, it makes filesize bigger, but siie does only matter if it doesn't fit
[05:55:05] <specing> itoa() bitches.
[05:55:10] <twnqx> there's no point in reinventing the wheel
[05:55:16] <beaky> right
[05:55:16] <Roklobsta> no
[05:55:22] <beaky> I reinvented the wheel
[05:55:22] <Roklobsta> reuse what's there
[05:55:30] <beaky> thinking that snprintf will be wose than what I did
[05:55:32] <beaky> worse*
[05:55:44] <beaky> I horribly reinvented it
[05:55:45] <twnqx> snprintf is more generic
[05:55:55] <twnqx> and probably you don't only want to print numbers
[05:55:58] <specing> *printf functions are all bloated
[05:56:05] <Roklobsta> you're bloated
[05:56:12] <specing> Yes I am
[05:56:18] <Roklobsta> it's true, they are a necessary evil
[05:56:19] * specing refactors himself
[05:56:43] <Roklobsta> how good is the libc for avr?
[05:56:51] <twnqx> well, if you only want integer to ascii
[05:56:54] <twnqx> itoa is the way to go
[05:56:56] <Roklobsta> is it rewritten or the standard libc?
[05:56:59] <Roklobsta> for gnu
[05:57:09] <twnqx> avr-libc is special
[05:57:22] <Roklobsta> touched by faeries?
[05:57:23] <twnqx> mostly posix compliant
[05:57:28] <twnqx> some extensions
[05:57:38] <Roklobsta> but is it's performance arse?
[05:58:01] <Roklobsta> and does the libc supplied in the avrgcc from atmel compiled to at least -O1?
[05:58:03] <twnqx> some size optimizations, e.g. multiple *print/scan* functions, without floating point if size matters
[05:58:41] <Roklobsta> i discovered the Tasking 'libc' in scanf didn't parse 0, 0.0, 0.000 or 0 of any kind.
[05:58:57] <twnqx> how much of a libc do you even use in embedded
[05:58:59] <Roklobsta> wasted a day, they sent a patch, drama over.
[05:59:05] <twnqx> print/scan, malloc/free
[05:59:19] <twnqx> sometimes math
[05:59:20] <Roklobsta> ew to malloc/free on avr
[05:59:26] <Roklobsta> staticlly allocate everything
[05:59:55] <Roklobsta> otherwaise your heap will crash into your stack
[06:00:00] <twnqx> can't
[06:00:05] <twnqx> my stack is below my heap.
[06:00:07] <Roklobsta> can
[06:00:19] <twnqx> stack & stack is in internal sram
[06:00:19] <Roklobsta> heap will fly off the databus and onto the floow
[06:00:20] <Roklobsta> r
[06:00:22] <twnqx> heap in the external :P
[06:00:32] <Roklobsta> ok
[06:00:35] <twnqx> stack & static*
[06:00:35] <Roklobsta> still
[06:00:42] <Roklobsta> what do you need malloc for?
[06:01:06] <beaky> when is avr better than arm?
[06:01:10] <twnqx> runtime detection of external memory & dependent sizing of some larger structures
[06:01:21] <twnqx> beaky: very low pincount
[06:01:36] <twnqx> so yeah, i don't free ever
[06:01:41] <twnqx> i just malloc during init
[06:04:51] <beaky> modern games malloc on init
[06:04:55] <beaky> that is why they are so fast
[06:05:09] <beaky> malloc only on init*
[06:05:15] <beaky> and on loading screens
[06:08:45] <specing> modern Quake games malloc 200+ MB on init and use it as the memory used by the Quake virtual machine
[06:13:50] <specing> but modern games don't run on 16 MHz chips with 1K ram ...
[07:05:34] <Roklobsta> yeah, if you have 8-64kB you really should know how all of it's being used
[07:06:00] <Roklobsta> i'm just saying having dealt with embedded systems that fail for 'unknown' reasons in the field you gotta understand everything that's going on.
[08:15:16] <braincracker> Semper Fi
[08:17:19] <Roklobsta> or die
[08:24:31] * twnqx stabs the infineon developers who designed the tricore cpu
[08:24:49] <twnqx> i fail to find a pattern in the instructions in order to write an emulator
[08:33:26] <Roklobsta> yeah i read about philips tricore ages and ages ago
[08:34:08] <twnqx> wow
[08:34:15] <twnqx> there must be some bad bug in my emulator
[08:34:32] <twnqx> it just changed a register that shouldn't be affected :S
[08:34:56] <Roklobsta> nono I am thinking of this http://en.wikipedia.org/wiki/TriMedia_%28mediaprocessor%29
[08:35:05] <Roklobsta> stack error!
[08:35:24] <twnqx> http://en.wikipedia.org/wiki/TriCore
[08:35:25] <Roklobsta> did it happen during or after a bunch of pops?
[08:35:27] <twnqx> that one
[08:35:34] <Roklobsta> yes car thingy
[08:35:37] <twnqx> 800024f4 37 02 70 13 extr.u %d1, %d2, 6 ($06), 16 ($10) <- this affects %d0
[08:35:42] <twnqx> and i am pretty sure it should not.
[08:36:33] <twnqx> i just set up the cpu in a way that makes it sure to crash :S
[08:36:59] <Roklobsta> tricore is meant to be SAFE. not do random crap
[08:37:18] <twnqx> my emulator ensures it does random crap!
[08:38:43] <Roklobsta> hang on, is this #tricore?
[08:38:53] <Roklobsta> or #tricoreemulatorwithavr?
[08:39:02] <twnqx> i used an avr to block the WDT
[08:39:05] <twnqx> is that good enough?
[08:41:00] <Roklobsta> yeah FU WDT. Eat hot AVR
[08:41:16] <Roklobsta> why are you using a tricore
[08:41:41] <twnqx> i am trying to reverse engineer a tricore program.
[08:42:25] <twnqx> and i kind of thought that writing an emulator including all IO would be the easiest way...
[08:43:09] <Roklobsta> trying to hack your car?
[08:43:33] <twnqx> in one way or the other, yes
[10:26:32] <mateusz__> Hi
[10:27:14] <mateusz__> if I burn fuses on attiny85 to disable reset and enable PB5, is it still possible to flash the chip? what are the consequences ?
[10:38:38] <hackvana> Yes, but you will need an HVSP programmer (it's not the more common ISP programmer). Here's an example: http://mightyohm.com/blog/products/hv-rescue-shield-2-x/
[12:50:15] <HylianSavior> does anyone have any idea if it's possible to make this TWI service from ASF work with multiple slave addresses? http://asf.atmel.com/docs/3.8.1/xmegaa/html/twi_quickstart.html
[12:56:52] <jadew> as far as I know, if you don't have 2 i2c peripherals, you'll only be able to assign one address
[12:57:14] <jadew> so if you want to listen on several i2c addresses, you'll have to sniff the bus instead
[14:19:19] <R0b0t1> oooo atmel has software framework?
[14:34:47] <jadew> yeah, only for xmega I think
[14:38:37] <R0b0t1> Mmm, I wanted to use xmega
[14:38:41] <R0b0t1> but then cortex happened
[14:40:43] <OndraSter> haha
[14:43:05] <Tom_itx> sucks for xmega
[14:45:01] <abcminiuser> SHWEET
[14:45:02] <abcminiuser> https://twitter.com/ivarho/status/351782934400864257
[14:45:28] <abcminiuser> R0b0t1, better be using a SAM D20 then... :P
[14:50:37] <R0b0t1> Eh
[14:50:51] <R0b0t1> It didn't seem particularly...
[15:04:24] <jadew> how does the cortex compare to the xmega?
[15:05:06] <abcminiuser> Cheaper :P
[15:05:07] <abcminiuser> Faster
[15:05:23] <jadew> good to know, gonna look into it
[15:09:10] <jadew> doesn't seem that much cheapper
[15:10:54] <twnqx> but an extra 0 on the clock.
[15:11:07] <jadew> really?
[15:12:11] <jadew> the ones I found aren't that impressive
[15:12:43] <twnqx> 150-200mhz are not rare
[15:13:09] <jadew> that's pretty bad ass
[15:13:34] * twnqx looks at 4ghz haswell
[15:13:38] <twnqx> nah, not really.
[15:25:59] <R0b0t1> jadew: Also 16 timers is normal, PWM generators with lots of options
[15:26:06] <R0b0t1> crypto module, hash module, RTC
[15:26:16] <R0b0t1> camera interface if you get an m4...
[15:26:27] <R0b0t1> usb host, device, and FS accelerator
[15:27:10] <R0b0t1> I saw new TI chip for car entertainment system. Dual A15 cores, dual M4 cores, at least dual of DSP, video, audio, computer vision optimized core
[15:27:12] <R0b0t1> dafuq
[15:27:28] <specing> All in < 5W, I take? :D
[15:27:29] <jadew> nice
[15:29:13] <specing> Tilera makes 55W WLIW processors with 64 cores running at 1.5 GHz
[15:29:17] <specing> How about that?
[15:29:23] <Isvara> Is anything special needed to use an avrispmkII programmer on Mac OS? I'm getting "usbdev_send(): wrote -34 out of 8 bytes, err = Result too large" on a project that works fine from Linux.
[15:29:26] <specing> And Linux runs on them
[15:30:26] <specing> Now if only they were available to mere mortals...
[15:31:02] <Isvara> WLIW? Weally Long Instruction Word?
[15:31:09] <specing> yes
[15:31:26] <specing> WLIW = compiler-level instruction paralelism
[15:31:38] <Isvara> What does it stand for?
[15:31:49] <specing> sorry, VLIW
[15:31:53] <specing> not WLIW :D
[15:32:06] <Isvara> Ha.
[15:32:15] <specing> those processors are so fast
[15:32:31] <specing> they ship with 4 10-gigabit ethernet controllers to feed it
[15:33:13] <specing> x86 is lulzworthy compared to VLIW designs
[15:33:37] <R0b0t1> specing: Yeppers
[15:33:41] <R0b0t1> Oh
[15:34:07] <R0b0t1> 64cores wat
[15:34:31] <specing> No matter how much Intel optimizes their cpus for power efficiency, they'll never be able to achieve what VLIW can
[15:34:40] <specing> R0b0t1: yes, they are working on 100+ core ones
[15:34:47] <R0b0t1> VLIW is almost like DSP though
[15:35:00] <R0b0t1> has certain optimizations, hope you can fit your problem to those optimizations
[15:49:09] <jadew> what's preventing them from implementing VLIW too?
[15:49:44] <twnqx> compatibility
[15:51:04] <jadew> hmm, I'm sure there are solutions to work around that
[15:52:10] <jadew> you could keep the old opcodes for single core execution + the new ones that at least the OS could take advantage of
[15:52:35] <twnqx> like they did with mmx. and sse. and avx. and...
[15:52:41] <jadew> new programs targetting that architecture wouldn't be backwards compatible, but.. meh
[15:52:42] <Isvara> It wouldn't really be the OS, though. More like applications.
[15:52:57] <twnqx> 64bit programs aren't 32bit compatible
[15:53:05] <jadew> that's true
[15:53:12] <twnqx> and you can always have conditional code runs, like media apps have today
[15:53:26] <jadew> what are those?
[15:53:53] <Isvara> twnqx: You can also choose your libraries at runtime, which I believe certain Adobe products do, for example.
[15:53:59] <twnqx> if (cpu has avx) use_avx(); else if (cpu has sse) use_sse(); else ...
[15:54:13] <jadew> ah, yeah
[15:54:16] <jadew> and what Isvara said
[15:54:25] <jadew> that MIGHT work
[15:54:45] <jadew> however interraction between 32 and 64 bit programs is not that straight forward
[15:55:03] <jadew> I'm not even sure you can load a 64 bit dll into a 32 bit app, or the other way around
[15:55:17] <jadew> I know for a fact I couldn't install my 32 bit BHO into the 64 bit explorer
[15:55:42] <jadew> (Browser Helper Object) - basically an explorer plugin
[15:56:16] <twnqx> no you can't
[15:56:50] <twnqx> at least not easily, there's weird shit you can do to make it work somehow, more or less :P
[15:56:53] <jadew> I'm sure it could be done with some magic tho :)
[15:56:57] <jadew> yeah
[15:57:35] <jadew> after all, 64bit windows is running 32 bit apps, so if the system can so can you :)
[15:57:42] <twnqx> there's a 32bit plugin loader for 64bit firefox on linux
[15:57:46] <twnqx> no
[15:57:56] <twnqx> the OS can switch the operatign mode on the CPU
[15:57:59] <twnqx> your app can't
[15:58:12] <jadew> well, you could write a kernel mode driver and do just that
[15:58:27] <jadew> it's all kernel calls
[15:59:01] <jadew> there's ceritanly a way to do it, but as you said, it's probably a weird road to take
[16:08:25] <nickjohnson_> Anyone have any tips for reducing power consumption on the ATTiny2313 beyond what power down mode provides?
[17:17:23] <cart_man> is there a good simulator for ARM processors?
[17:22:13] <Roklobsta> no
[17:22:21] <Roklobsta> well maybe
[17:22:26] <Roklobsta> but this is #avr
[17:23:20] <Roklobsta> far out man, just type "arm simulator" into google
[19:29:30] <braincracker> h
[19:29:51] <Tom_itx> w
[19:30:18] <Roklobsta> t
[19:30:43] <Roklobsta> Tom_itx: do you ever sleep?
[19:30:53] <Tom_itx> no
[19:31:12] <braincracker> how's microcontroller land?
[19:31:35] <Roklobsta> hmmm, need to write an m25p driver.
[19:31:43] <braincracker> whatever that is
[19:31:52] <braincracker> what does it drive? car?
[19:31:54] <Roklobsta> spi eeprom chip
[21:30:39] <HylianSavior> does anyone have any idea if it's possible to make this TWI service from ASF work with multiple slave addresses? http://asf.atmel.com/docs/3.8.1/xmegaa/html/twi_quickstart.html