#avr | Logs for 2014-09-09

Back
[00:40:24] <rue_more> mheld-irccloud, hi
[00:42:21] <mheld-irccloud> sup?
[00:42:55] <rue_more> does that take into account that program memory needs to be reprogrammed in blocks?
[00:43:52] <rue_more> mheld-irccloud, which avr are you using and how many bytes of ram does it have?
[00:44:24] <mheld-irccloud> I'm using at xmega16a4u
[00:44:27] <mheld-irccloud> an*
[00:44:33] <rue_more> uint8_t string_length = strlen_P(progmemed_string);
[00:44:33] <rue_more> char string_buf[string_length];
[00:44:43] <rue_more> ah xmega
[00:44:47] <mheld-irccloud> is that gross?
[00:44:51] <mheld-irccloud> should I not be doing that?
[00:44:58] <rue_more> pretty sure you cant do that
[00:45:17] <mheld-irccloud> I wanted to log out the strings as I was sending it down the wire
[00:45:26] <rue_more> you need to learn how to write code for microcontrollers, your writing cpu code
[00:45:50] <rue_more> cpu's have lots more ram available as direct memory access
[00:46:23] <mheld-irccloud> that makes sense
[00:46:24] <rue_more> on a microcontroller you use the strings you need directly, you dont throw around a bunch of pointers
[00:46:37] <rue_more> and you dont dynamically allocate memory
[00:46:56] <mheld-irccloud> I don't think all the strings in my code would fit in the space allotted
[00:47:15] <rue_more> it dosn't mean you cant have strings in program memory,
[00:47:26] <mheld-irccloud> isn't that the point of progmem?
[00:47:32] <rue_more> sure as to heck you dont use the program memory for realtime storage
[00:47:41] <mheld-irccloud> I'm not!
[00:48:12] <rue_more> it looks like you want to make a function to write a string to program memory
[00:48:13] <rue_more> ?
[00:48:24] <rue_more> my at needs attention
[00:48:31] <mheld-irccloud> it takes the progmemmed string that I have, and shoots it off to usart
[00:48:40] <mheld-irccloud> copying it in the meantime because I want to log it
[00:48:54] <mheld-irccloud> but I'm having a hard time figuring that out
[00:49:16] <mheld-irccloud> the breakpoints are only printing out things like {char[1]{data}@0x00e4 ([R12]+0)}
[00:49:25] <mheld-irccloud> which is challenging to figure out
[01:56:20] <rue_house> ah
[01:56:36] <rue_house> why dont you use an index pointer to an array of strings, instead of a char*
[01:57:24] <Roklobsta> what's the code?
[02:00:40] <rue_house> its midnight, I dont know
[02:10:04] <Roklobsta> i generally prefer using indexs to pointers for clarity. gcc should make the same optimal code if written either way
[02:10:25] <Roklobsta> *for all cases of _should_ except when it shouldn't.
[05:12:13] <MrBar> hi dudes!
[05:13:42] <MrBar> avrdude fails when send bootloader :(
[05:15:01] <MrBar> avrdude crap!
[05:32:26] <bezoka> hello
[07:46:35] <mheld-irccloud> why is my board_init() getting optimized out?
[07:47:13] <mheld-irccloud> I have a breakpoint in my main() function and atmel studio is saying that it never hits it
[08:08:35] <ecilop> source?
[09:58:09] <rue_mohr2> mheld, because its just NOP(); and your using -o4
[09:58:15] <rue_mohr2> mheld-irccloud, ^^
[10:07:20] <mheld-irccloud> rue_mohr2: I'm using -O0
[10:08:17] <mheld-irccloud> why would it be nop-ed anyway?
[10:11:57] <rue_mohr2> from the code you posted, I see your function is just a NOP(); call from C
[10:13:03] <rue_mohr2> it also dosn't help you didn't call it
[10:17:28] <mheld-irccloud> rue_mohr2: http://pastie.org/private/saopwthdo5pq6nu6u6bkw
[10:17:57] <mheld-irccloud> rue_mohr2: board_init(), pmic_init(), and sleepmgr_init() are all getting nop-ed
[10:18:03] <rue_mohr2> I'm not saying its nopped
[10:18:04] <mheld-irccloud> no clue why
[10:18:08] <rue_mohr2> I'm saying your code is
[10:18:32] <rue_mohr2> foo board_init(void) { NOP(); return 0;}
[10:19:08] <rue_mohr2> see, from what you posted THATS your board init fn
[10:19:33] <mheld-irccloud> it's the xmega on stk600 board_init call
[10:19:35] <mheld-irccloud> I didn't write it
[10:19:47] <rue_mohr2> exactly
[10:19:51] <mheld-irccloud> what?
[10:20:07] <rue_mohr2> I'm an hour late for work, bye!
[10:20:42] <mheld-irccloud> hah
[10:20:55] <mheld-irccloud> thanks for the help
[11:22:08] <twnqx> mheld-irccloud: what he's saying is that just maybe the functions actually do not exist
[11:22:23] <twnqx> #define board_init()
[11:22:28] <twnqx> as there is nothing to init
[11:22:41] <twnqx> and suddenly - nothing to step through
[11:24:04] <twnqx> i'm not an atmel studio user, but i'd just gcc -E your function and see what's left after preprocessing
[11:24:16] <twnqx> or you could look at the geenrates assembly
[14:22:21] <Duality> hi
[14:22:35] <Duality> anyone seen these ? http://hackaday.com/2014/08/26/new-chip-alert-the-esp8266-wifi-module-its-5/
[14:47:18] <bezoka> can someone explain me how to mix asm and c
[14:47:33] <bezoka> I will write in asm and use function from c library
[14:48:12] <jeremyabel> typically you do it the other way around
[14:48:24] <jeremyabel> you can inline ASM in C
[14:48:45] <bezoka> I know it
[14:48:50] <jeremyabel> __asm__("movb %bh (%eax)");
[14:48:58] <bezoka> but I want have c in asm code :D
[14:49:08] <jeremyabel> yeah but I don't think you can
[14:49:16] <jeremyabel> it's gonna be a .c file
[14:49:22] <jeremyabel> why do you want c in asm?
[14:49:38] <bezoka> I want write in asm and use c library
[14:49:42] <bezoka> for example for lcd
[14:49:46] <jeremyabel> right but why?
[14:49:50] <jeremyabel> what benifit does that offer?
[14:49:56] <jeremyabel> why not just C with the ASM you need?
[14:50:12] <bezoka> asm is faster :)
[14:50:29] <jeremyabel> what do you need the C functions for then?
[14:50:34] <jeremyabel> just do it all in asm
[14:51:00] <bezoka> it's borin rewrite ~300 lines
[14:51:12] <bezoka> boring*
[14:51:27] <jeremyabel> well, you might have to if you want to just use asm
[14:51:51] <jeremyabel> as far as I know you can't write straight asm and insert C
[14:51:56] <jeremyabel> only write C and insert ASM
[14:52:12] <bezoka> it's possible :)
[14:53:18] <bezoka> https://courses.engr.illinois.edu/ece390/books/labmanual/c-prog-mixing.html
[14:53:24] <bezoka> 8.2.2
[14:53:28] <jeremyabel> it sounds... gross! I'm not really knowledgable enough to guide you in any sort of legit direction
[14:53:48] <bezoka> but I dont how to link for example "io.h"
[15:24:50] <bezoka> jeremyabel: I think better is rewrite that library to asm than search how do it what I want
[15:24:53] <bezoka> :D
[15:25:01] <jeremyabel> I agree
[15:51:42] <bezoka> I am hungry, but my girlfriend is in her friend ;/
[15:52:07] <jeremyabel> your girlfriend is in her friend?
[15:52:13] <bezoka> oh
[15:52:19] <jeremyabel> uhhhhh you better get over there man!
[15:52:20] <bezoka> with her friend
[15:52:23] <jeremyabel> there we go :P
[15:52:29] <bezoka> in her house
[15:52:29] <bezoka> :D
[15:52:33] <jeremyabel> you can't cook your own food? :P
[15:52:40] <bezoka> I can
[15:52:44] <bezoka> but I am in her house
[15:52:44] <bezoka> :D
[15:54:28] <jeremyabel> ah ok
[16:46:26] <bezoka> I want write program in asm and use one library from c
[16:46:47] <bezoka> but people only explain how write in c and use asm :D
[16:50:08] <wulax> maybe use objdump or gcc -S to extract assembly code from the c library then use that?
[16:50:15] <wulax> I dunno
[16:51:44] <Tom_itx> that's because you generally write c and use inline asm or asm calls
[16:51:48] <Tom_itx> not the other way around
[16:55:45] <bezoka> wulax: that can be good idea
[16:56:03] <jeremyabel> Tom_itx: that's what I tried to tell him :P
[16:56:31] <Tom_itx> i'm not saying it's impossible but highly impractical
[16:56:55] <jeremyabel> tried to tell him that too!
[16:57:49] <Tom_itx> so i see... i hardly ever read past the screenfull of backlogs anymore
[16:58:15] <jeremyabel> I don't know how to scroll in irssi so I never bother...
[16:58:28] <Tom_itx> unless something just happens to stand out and i'm interested...
[17:00:39] <wulax> jeremyabel: page up/down?
[17:00:44] <wulax> :-)
[17:00:48] <jeremyabel> nope that pages my SSH terminal
[17:01:06] <jeremyabel> I'm in ssh, screen into irssi
[17:01:21] <wulax> oh, then alt+n/p I think
[17:01:22] <Tom_itx> http://www.nongnu.org/avr-libc/user-manual/assembler.html
[17:01:43] <wulax> i converted to weechat though. much nicer defaults.
[17:01:47] <jeremyabel> alt+n/p gives me ñ and π :P
[17:03:41] <bezoka> I want write program in assembler, but I need function from c library :)
[17:03:47] <Tom_itx> http://www.delorie.com/djgpp/doc/ug/asm/calling.html
[17:03:50] <Tom_itx> read that
[17:03:57] <Tom_itx> you're silly for doing it though
[17:04:18] <jeremyabel> lol
[17:04:43] <Tom_itx> you don't know what regs the c lib will use either so you will have to push them all
[17:05:03] <jeremyabel> oh god yeah, totally forgot about that
[17:05:04] <Tom_itx> that will eat up your stack quickly
[17:06:33] <bezoka> ftp://www.inf.fh-dortmund.de/pub/contributors/rottke/ATMEL/APPLICAT/AVR034.PDF
[17:06:33] <bezoka> table 2
[17:07:33] <jeremyabel> sho nuf
[17:09:06] <Tom_itx> https://gcc.gnu.org/wiki/avr-gcc#Calling_Convention
[17:09:28] <Tom_itx> i have all the notes on my hdd
[17:09:35] <jeremyabel> handy
[17:09:46] <Tom_itx> as well as all the part pdfs
[17:09:56] <rue_mohr2> some version
[17:10:11] <Tom_itx> you can download the 'cd'
[17:12:12] <wulax> could you give a link please, Tom_itx?
[17:12:27] <Tom_itx> umm
[17:12:35] <Tom_itx> i don't have it bookmarked
[17:12:48] <Tom_itx> but if you hunt hard enough, it's there
[17:13:06] <Tom_itx> i think it's on the .no site
[17:14:32] <wulax> ok
[17:15:31] <Tom_itx> i'll post it if i find it
[17:19:02] <Tom_itx> dean!
[17:19:10] <Tom_itx> just the guy i was looking for...
[17:19:22] <abcminiuser> Oh?
[17:19:27] <abcminiuser> Can I put pants on first?
[17:19:31] <Tom_itx> do you know where they hide the resource CD?
[17:19:36] <Tom_itx> with all the pdf's on it?
[17:19:39] <Tom_itx> app notes etc
[17:19:47] <abcminiuser> It was obsoleted as marketing wanted people to use the site more
[17:19:52] <Tom_itx> pfft
[17:20:06] <Tom_itx> what was the last one.. do you know?
[17:20:42] <twnqx> use a scraper to make your own!
[17:21:04] <Tom_itx> wulax if you want the one i have i can post it somewhere
[17:21:22] <Tom_itx> it's dated 2013
[17:21:36] <Tom_itx> 7G
[17:21:46] <abcminiuser> I've still got ye-olde datasheets from years ago
[17:21:49] <abcminiuser> Yeah the 2013 one
[17:21:59] <Tom_itx> err is that 7M
[17:24:38] <wulax> it would be great if you could Tom_itx. I considered auto-downloading from the website, but the pdfs have names like doc320987.pdf :-(
[17:25:01] <jeremyabel> yeah I hate how they name them
[17:25:39] <Tom_itx> any other takers pm me, i'm not gonna post it to the GP
[17:26:56] <Tom_itx> my isp might get pissed at me...
[17:27:06] <Tom_itx> not that that's anything new...
[17:27:50] <abcminiuser> I forsee much more problems being posted here in the future: "It is possible to disable warnings about conversions between pointers that have incompatible types via a new warning option -Wno-incompatible-pointer-types" (from GCC 5.0 changelog)
[17:29:13] <twnqx> the only legt flags for warnings
[17:29:35] <twnqx> are -Wall -Werror -pedantic <and then something even more pedantic which i forgot>
[17:31:32] <Lambda_Aurigae> Duality, old news....and no proper documentation on the chip yet.
[17:32:01] <abcminiuser> -Wextra
[17:32:09] <abcminiuser> No one compiles with -pedantic
[17:32:18] <abcminiuser> Or rather, no one compiles successfully
[17:33:08] <jeremyabel> lol
[17:33:11] <jeremyabel> there's a -pedantic?
[17:33:22] <abcminiuser> Jupp, which is exactly as described
[17:33:25] <jeremyabel> love it
[17:33:53] <abcminiuser> https://stackoverflow.com/questions/2855121/what-is-the-purpose-of-using-pedantic-in-gcc-g-compiler
[17:33:53] <twnqx> i do!
[17:34:02] <abcminiuser> It basically turns your compiler into one from the 80s
[17:34:17] <bezoka> c take too large flash, that is reason why I will write in asm
[17:34:19] <twnqx> nom, you can still use c99
[17:34:55] <twnqx> what was it that cause me problems...
[17:35:03] <abcminiuser> Sadly LTO usually ends up generating *larger* code for me
[17:35:10] <twnqx> anon unions in structs, or something like that
[17:35:45] <abcminiuser> Mmm, anon unions
[17:37:01] <abcminiuser> If I was building a new C spec, I'd add in a) loop unroll hints, b) switch-cases must be terminated by continue (fallthrough), return or break, c) endianness specifiers on types, d) packing order on structs/bitfields
[17:39:26] <twnqx> abcminiuser: i remember 4 options, hmm
[17:39:50] <twnqx> CFLAGS+=-Wextra -Wshadow -Wpedantic
[17:40:05] <twnqx> CFLAGS=-Wall -Werror -g -O3 -march=native -I. -std=c11 -D_BSD_SOURCE before that :P
[17:40:26] <twnqx> so -Wpedantic, not -pedantic
[17:41:45] <abcminiuser> Oooh, c11, fancy
[17:42:00] <abcminiuser> -Werror is fun
[17:42:05] <twnqx> what
[17:42:15] <twnqx> if it has warnings it doesn't deserve to compile
[17:42:18] <abcminiuser> We use it at work, causes all sorts of madness when building locally with GCC and submitting to the Clang server
[17:42:42] <abcminiuser> Clang has much better static analysis built in, so it gives more warnings (usually about implicit truncation)
[17:43:46] <twnqx> i think some anon elements (anon enums? anon unions in structs?) were a feature that "was there" for a long time, but failed with -Wpedantic :P
[17:44:26] <abcminiuser> Yeah that's right, I had to put my foot down and revert to c99 due to shitty IAR
[17:44:34] <abcminiuser> Also known as the WHAT YEAR IS IT compiler
[17:44:51] <twnqx> can't really remember what, but this project is such a hell of macro expansions, variadic macros/functions, dynamic parameter count macros
[17:45:04] <twnqx> i had to go to this length to make sure that the output might be what i want
[17:45:34] <jeremyabel> twnqx: amen to 0 errors
[17:45:36] <jeremyabel> er, warnings
[17:45:45] <twnqx> it also uses perl and awk to generate C code.
[17:45:51] * jeremyabel cringes
[17:46:03] <jeremyabel> well at least it's not python generating C code...
[17:46:26] <twnqx> it's just table expansion beyond what i managed with preprocessor magic :P
[17:46:53] <Tom_itx> wulax, it's gonna take a while
[17:47:01] <Tom_itx> ~1/3 done
[17:47:18] <abcminiuser> That's what GCC needs; the ability to compile with -mexpand <something> and have the preprocessor iteratively spit out each expansion step so you can see WTF is going on for a given token
[17:47:24] <wulax> thanks for taking the time Tom_itx
[17:48:13] <twnqx> and what C needs: really dynamic macros that expand differently based on other #defines
[17:48:13] <Tom_itx> i'm not directly connected to the server or it'd be quicker
[17:48:37] <jeremyabel> that'd be cool
[17:48:59] <twnqx> heck, just #if inside #define would be good enough
[17:49:10] <twnqx> yes, you can fiddle with X-Macros
[17:49:15] <twnqx> but meh
[17:49:40] <jeremyabel> yeah that'd be pretty clean, #if inside #define
[17:49:44] <jeremyabel> I'd be super into that
[17:50:08] <twnqx> trust me
[17:50:14] <twnqx> that ends pretty soon
[17:50:25] <twnqx> after you need gcc -E to understand what's going on
[17:50:44] * abcminiuser showertime
[17:50:45] <jeremyabel> #define polymorphism :P
[17:50:51] <twnqx> i have helpers that generate reduced versions of my meta-code and feed them straight to gcc -E just to see what's going on
[17:51:15] <jeremyabel> neat
[17:51:18] <jeremyabel> ish :P
[17:51:28] <bezoka> jeremyabel: I think I just know how make what I want !
[17:51:37] <jeremyabel> only metacode I've ever done is shader-generating code
[17:51:46] <jeremyabel> bezoka: oh?
[17:52:03] <bezoka> wulax: thanks bro
[17:52:23] <twnqx> ah right
[17:52:27] <bezoka> avr-gcc -s whatever.c -o whatever.o
[17:52:27] <bezoka> :D
[17:53:04] <twnqx> this were i aborted this projected for now
[17:53:06] <twnqx> still need to figure out the best way for overflow detection on 32bit multiplication
[17:53:26] <jeremyabel> hmmmm
[17:53:41] <jeremyabel> on a 32-bit system I assume? :P
[17:53:52] <twnqx> "kind of"
[17:54:05] <twnqx> i have a solution for 64bit PC - just use 128bit integer type
[17:54:07] <twnqx> yey, gcc
[17:54:56] <wulax> bezoka: it was the first thing that came to my mind. I have no idea if it will work out for you, or how much you will have to manually edit the code to fit if you do that.
[17:55:50] <wulax> bezoka: but good luck I guess :)
[17:56:28] <twnqx> anyway, bedtime
[17:56:54] <twnqx> Lambda_Aurigae: sounds like i'll grab a few of those wireless chips on my next trip to shenzhen :P
[17:57:23] <jeremyabel> night
[18:03:14] <bezoka> wulax: I give c code to asm and link with my asm program
[18:04:28] <wulax> alright
[18:12:18] <Tom_itx> 3/4 done
[18:15:19] <jeremyabel> Tom_itx: how big is this file? :P
[18:16:14] <wulax> gotta catch 'em all
[18:24:14] <Tom_itx> 7,016,834kb
[18:24:24] <jeremyabel> good gravy
[18:24:34] <Tom_itx> i said it was big
[18:24:57] <Tom_itx> < 1 min left
[18:25:06] <jeremyabel> impressive upload speed tho
[18:25:15] <jeremyabel> (compared to mine)
[18:25:27] <Tom_itx> my down is supposed to be 50mbit
[18:25:32] <Tom_itx> up is alot worse
[18:25:53] <Tom_itx> wulax, ok it's there now
[18:26:03] <wulax> thanks again!
[18:26:17] <Tom_itx> nearly 7 Gb
[18:27:39] <wulax> seems it will take 2-3h
[18:27:59] <Tom_itx> it took a while to get it from them
[18:46:09] <nhere> i want to connect ATtiny2313 to STK500 using HVPP, i am not sure where to connect two pins: http://i.snag.gy/DHAja.jpg
[18:47:13] <nhere> there are seperate pins on STK500: BS1 and PAGEL, but ATtiny2313 has one pin that shares both, it is called BS1/PAGEL
[18:48:35] <nhere> should i connect BS1 -> BS1/PAGEL or PAGEL -> BS1/PAGEL, or BS1 & PAGEL -> BS1/PAGEL?
[18:50:03] <jeremyabel> try PS1 -> BAGLE
[18:50:24] <jeremyabel> (assuming PS1 is some new brand of cream cheese I'm not aware of)
[18:51:03] <nhere> :)
[18:51:49] <jeremyabel> that's tricky though, I'm not sure what the proper way is
[18:52:05] <nhere> what about XTAL1, where should it be connected?
[18:52:12] <jeremyabel> which makes me feel dumb cause my very first AVR experience was with a STK500 and a ATtiny2313
[18:52:20] <jeremyabel> XTAL1 is for an external crytal oscillator
[18:52:24] <jeremyabel> along with XTAL2
[18:53:56] <nhere> i see
[18:54:48] <jeremyabel> XTAL1 goes to one end of crystal, XTAL2 to the other
[18:55:01] <jeremyabel> you don't need them though, you can use the internal oscillator by default just fine
[19:11:27] <bezoka> good night
[19:11:29] <bezoka> bye