#qi-hardware IRC log for Saturday, 2014-05-31

zrafahey hey00:06
zrafawhere are the arm cortex-m hackers here? :)00:06
zrafaI would like to learn if it is possible to load some code in RAM in reset mode and then to jump to this code. We are using swd with the mk20 and in reset mode we are able to load some code in ram. But, we can not change the vtor in reset mode, so we would like to know if after to leave from reset we can jump to our code in ram. I do not have hardware to test right now :( we have this problem at uni, but I can test from time to time. IN reset mode, if we loa00:09
zrafasome code in ram, could we change register 15 (program counter) then leave from reset to try to jump to our code in ram?00:09
zrafathe mk20 is an arm cortex-m400:10
whitequarkzrafa: I did that with m300:18
whitequarkwell00:18
whitequarkdefine "reset mode" more precisely00:18
wpwraki guess SWD mode entered after reset, with the core being debugged00:19
wpwrakand yes, i think that should work00:20
whitequarkyes, then I did exactly that00:20
wpwrakthough, why would you do it like this ? just run your fw from reset, that is unless you plan to use a debugger00:21
whitequarkzrafa: setting the PC would work as you expect00:31
whitequarkPC isn't that special in ARMs.00:31
zrafawpwrak: we have a little gdb server in SIE board, with ubb to have SWD with mk2000:33
zrafawpwrak: then we can not flash the mk20 yet, or at least, we want to try to load some code (we can right now) on RAM, and then we would like to jump there after leaving from reset00:33
zrafawhitequark: cool ! :) (setting the program counter)00:34
zrafawhitequark: I will try then :)00:34
zrafawhitequark: I can not test right now, but we triet to set VTOR to something in RAM, but in reset mode it seems that we can not change that value (if we change and then we read vtor still is 0x0000000000:35
zrafa)00:35
zrafawpwrak: ^00:35
wpwrakah, and regarding the new happy marriage of Apple and Beats, i wonder if someone will make an update of: www.businessinsider.com/these-are-the-14-best-economist-covers-2011-7#the-trouble-with-mergers-september-10-1994-100:35
whitequarkzrafa: VTOR?00:36
whitequarkthe vector table, right?00:36
wpwrakzrafa: ah, i'd try to solve the flashing then :) all you need is a DFU loader. after than, you can use DFU. doesn't get any more comfortable :)00:36
whitequarkor you can flash it via the debugger just as well.00:38
whitequarksee how texane/stlink does it00:38
whitequarkbasically you build this https://github.com/texane/stlink/blob/master/flashloaders/stm32f4.s00:39
whitequarkthen upload it to an arbitrary position in RAM together with the bytes to flash, and jump to it00:39
whitequarkgdb can instruct the gdbserver to do that, too.00:39
zrafawhitequark: yeaht, the vector table00:43
zrafayes, we can write on flash as well, but we want to play with our experiments just to learn00:44
whitequarknot sure why VTOR won't change, that sounds weird00:44
zrafawpwrak: no just to flash something and then forgot what all this swd is about :)00:44
wpwraki suppose you tried the mechanism you use to change the VTOR already on, say, a port register to toggle a LED and such ?00:44
zrafawhitequark: we were thinking that we could not chang vtor because in reset mode00:45
zrafawpwrak: led okey yes00:45
zrafa:)00:45
wpwrakand at what address is VTOR ?00:46
whitequark0xE000ED0800:47
zrafa0xE000ED08 VTOR RW Privileged 0x00000000 Vector Table Offset Register00:47
zrafa:)00:47
whitequarkvtor shouldn't behave like that00:47
whitequarkbut I'm too lazy to pull out my stm boards00:47
zrafawhitequark: if we write on RAM and READ after that, then new value is on RAM and all is okey. The same with some registers, for example, to turn on a led00:48
wpwrakhmm, if you two agree, then i won't bother with checking ;-)00:48
zrafabut today we were thinking to load some code in RAM (we did, because we are using a incomplete gdb server), but when we tried to change00:48
zrafavtor then after read it again it showed us 0x00000000 :(00:49
whitequarkzrafa: what have you changed it to?00:49
whitequarkwhat's the CPSR value (are you in privileged mode?)00:49
whitequark(you should be)00:50
zrafawhitequark: we tried to put in vtor some valid RAM address00:50
whitequarkit needs to be properly aligned00:51
whitequark0x20000000 should work fine00:51
zrafawhitequark: wpwrak : my new doub is ... if in reset mode we change the register 15 (program counter) to some address in RAM, after leaving the reset mode, will not it change the register again with 0x00000004 ?00:52
zrafawhitequark: yes, we did00:52
zrafa(aligned)00:52
wpwrakzrafa: what value did you try ?00:52
zrafawpwrak: let me check the logs00:55
zrafabah, dont have access to my pc at uni, but I am sure that it was a correct ram address and aligned (and using just the bits[29:7] vtor use for that offset)00:58
zrafawpwrak: ^00:58
zrafawhitequark: wpwrak : my new doub is ... if in reset mode we change the register 15 (program counter) to some address in RAM,  after leaving the reset mode, will not it change the register again with 0x00000004 ?01:00
wpwrak(ram address) as in 0x2000xxxx ? (i.e., SRAM_U, not SRAM_L)01:01
wpwrakdunno. i wouldn't expect it to, but of course, there can always be surprises :)01:01
wpwrakwhen you read it back immediately after writing, without any other changes to the CPU state, what do you obtain ?01:02
wpwrakis the value changed then or still 0x0...xx ?01:02
zrafawpwrak: I can not test right now :(01:04
zrafawpwrak: I was thinking this idea (program counter) after I left uni office we the frustration of vtor01:04
zrafatests01:04
zrafaand now I can not test 01:04
zrafawe the= with the 01:05
wpwrakso you never checked whether the write succeeded ?01:05
whitequarkthere's also this question01:06
whitequarkif you *remove the halt signal* to the core, it will just continue as usual01:06
zrafano no.. we did not try the program counter idea. We tried to change vtor but we checked that the write was unsucefull01:06
zrafa:(01:06
whitequarkif, however, you *reset the core* (and since you appear to want the core to jump to the reset vectory, you probably do), the vtor will be probably reset as well01:07
whitequarklooking as it's a core register01:07
whitequarkthere's a rather complicated system of resets in the m-series01:07
zrafawhitequark: yes, and we are suffering with this complicated system in our little tests with the idea to learn :)01:07
whitequarkit's entirely described in the manual01:08
whitequarknote that if vtor is indeed reset, pc will be reset too. so you need to find a way to run the core rather than resetting it01:08
whitequarkI just do set $pc = ...; set $sp = ...; cont; in gdb01:08
wpwrakas yes, if you change the vtor just to change the reset vector, than that's not likely to work, since resetting the core will also reset vtor :) see also B.1.5.5 (page 438) of http://web.eecs.umich.edu/~prabal/teaching/eecs373-f10/readings/ARMv7-M_ARM.pdf01:08
zrafawhitequark: we have a bare metal micro, no profesional boards or things like that, just the mk20 micro from freescale factory, naked. With just the pins of swd and powering and reset. We use UBB from werner to use swd software from the SIE board01:16
zrafawhitequark: we have some little gdb server in sie board, but it is not complete. All this little monster use the swd software from werner as well01:16
zrafawith this little incomplete gdb server01:17
zrafathen we are in reset mode, because if we leaving the reset mode we lose the control etc01:17
zrafain reset mode we are learning about the posibilities01:18
whitequarkwell... then your only option is to finish the swd-gdb server to make it work properly01:18
whitequarkit is not hard01:18
zrafawe do not have easy software to flash or build programs (like eclipse, or proper bootloaders, etc)01:18
whitequarkyou can use my stlink gdbserver as a template01:18
zrafaso we have not flashed useful software yet01:18
zrafawe do not have recovering tools either, etc. All our tests are very fragile and minimal :)01:19
zrafawhitequark: okey, we are trying yes :)01:19
wpwrakmy libswd does have code for flashing .... :)01:23
wpwrakuses a fairly direct approach, without running code on the device01:23
wpwrakfor those reading german and likes google more than EUcracy: this looks like a fun idea: www.heise.de/newsticker/foren/S-Durch-Abgleich-mit-google-com-erfaehrt-man-dann-wem-was-peinlich-war/forum-280509/msg-25295826/read/09:58
wpwraknow, all you need is the domain googlediff.something (e.g., .com is still available), and a bit of code that talks to the search apis ...09:58
whitequarkthat could actually prove to be a problem10:09
whitequarkgoogle doesn't like people scraping its results very much.10:10
whitequarkof course, you could just pair it with http://antigate.net ;)10:10
whitequarker http://antigate.com/10:10
wpwrakhmm, there's googlefight, duckduckgo, etc. seems that they don't mind overmuch10:13
whitequarkgooglefight is rand() in disguise10:13
whitequarkduckduckgo doesn't scrape google, they use bing and their own heuristics (not indexing)10:14
eintopfduckduckgo rocks10:14
whitequarkit sucks at finding relevant stuff10:14
whitequarkit rocks at providing answers by template, but it is not a good search engine.10:14
whitequarkbecause well, duh, bing10:14
wpwrak(antigate) now that sounds useful. someone should make a plugin for chromium "solve this annoying captcha for me" ;-)10:14
whitequarkthat wouldn't fly most likely10:15
whitequarkoh10:15
whitequarkhttps://chrome.google.com/webstore/detail/anti-captcha/nconiknmmhhhffhmbknbplalknajiaef?utm_source=chrome-ntp-icon10:15
whitequarkI'm fairly certain google *will* block this if it gets more popular10:15
whitequarkseeing as it's against Google's (other) ToS and they don't really give a fuck anyway10:16
eintopfehm, this plugin isn't popular. You are sure that this plugin working well?10:22
whitequarktry it?10:24
DocScrutinizer05wpwrak: (google-diff) awesome! not that I had missed to ponder similar stuff when I heard that google.com still provides the links13:36
nicksydneywpwrak: interesting http://wiki.openmoko.org/wiki/Qi .. were you part of it ?14:51
nicksydneyaccording to this http://www.slideshare.net/kanru/android-boot-time-optimization?qid=0d5ae513-a5d0-4012-a32b-c586e6f64e24&v=qf1&b=&from_search=247 (Page 38) Qi-boot takes < 1s while u-boot + Xloader takes > 5s14:52
whitequarktoo many things named "qi"...14:52
nicksydneysometimes i mistaken qi to qué :)14:53
eintopfwhitequark: never install a russian chrome plugin :-)14:59
DocScrutinizer05nicksydney: iirc wpwrak been father of Qi15:09
DocScrutinizer05qi*15:09
DocScrutinizer05I might as well be wrong on that one15:11
nicksydneyfather or grandfather ?15:11
DocScrutinizer05oops, http://people.openmoko.org/andy/15:14
DocScrutinizer05dunno then15:14
DocScrutinizer05hmmpf, clicking on git://git.openmoko.org/git/qi.git opens giggle, but it looks rather useless and void to me15:25
wpwraknicksydney: no, that was the work of Andy Green. just made a few tiny changes to it.15:37
DocScrutinizer05and I guess even Andy didn't invent it15:39
DocScrutinizer05giggle is pretty useless15:39
wpwrakas far as i recall, he pretty much did. well, we may have talked about such a thing before. i never exactly liked u-boot :)15:40
DocScrutinizer05has a "clone data" but that doesn't do anything useful. I really wonder what's the use of the mimetype invoking giggle when clicking on git://git.openmoko.org/git/qi.git15:41
DocScrutinizer05~xyawn15:41
DocScrutinizer05ooh15:42
DocScrutinizer05anyway hot coffee15:42
DocScrutinizer05seems qi bootloader been named by http://en.wikipedia.org/wiki/Alan_Cox16:23
DocScrutinizer05wpwrak: was Alan involved into OM sw development?16:23
wpwrakno, but he had been listening in. could be that he suggested the name.16:27
DocScrutinizer05http://git.openmoko.org/?p=qi.git;a=blob;f=README;hb=HEAD16:34
DocScrutinizer05familar names on http://git.openmoko.org/?p=qi.git;a=commit;h=HEAD :-)16:35
DocScrutinizer05but yeah, initial commits been by Andy obviously16:36
--- Sun Jun 1 201400:00

Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!