#avr Logs

Mar 22 2018

#avr Calendar

01:03 AM day__ is now known as day
02:28 AM nikomo_ is now known as nikomo
04:54 AM Haohmaru: what about dynamic memory on the stm32? new/delete gud idea?
04:55 AM Haohmaru: i will try to avoid it at all costs, but i can't predict the future yet
04:55 AM nohitzwork: idk
04:55 AM nohitzwork: i have very little experience with c++
04:55 AM nohitzwork: but keep in mind that cubemx creates c projects, not c++
04:56 AM Haohmaru: yeah, i saw
04:57 AM Haohmaru: that's why i want to try to get <some> code built first
04:57 AM nohitzwork: you can create c++ projects with truestudio and then import the files there manually, that's how im going to do it with my c++ project
05:39 AM _ami_: Haohmaru, what i have noticed that if i use new/delete operator in my code, the binary size gets increased by 48Kb.
05:39 AM _ami_: in stm32.
05:39 AM _ami_: using arm-g++/gcc
05:39 AM Haohmaru: wowz
05:40 AM Haohmaru: but it works?
05:40 AM _ami_: yes,
05:40 AM Haohmaru: good, i can probably pay that price then
05:40 AM Haohmaru: if i absolutely must use dynamic memory
05:41 AM _ami_: also i have used placement new too.
05:41 AM _ami_: it was bit slow, but it did work
05:41 AM Haohmaru: placement?
05:42 AM Haohmaru: i'm currently looking at this chip: STM32F401RB
05:42 AM _ami_: Haohmaru, https://en.wikipedia.org/wiki/Placement_syntax
05:42 AM Haohmaru: 64 pins, 64K ram
05:43 AM _ami_: it is quite useful in writing your own memory allocator.
05:43 AM _ami_: char pointAllocHere[100];
05:44 AM _ami_: A *a = new (pointAllocHere) A;
05:44 AM Haohmaru: ah, funky
05:44 AM _ami_: A allocates from pointAllocHere + sizeof A;
05:44 AM _ami_: pointAllocHere to pointAllocHere + sizeof A
05:46 AM _ami_: btw, time to go home.
05:46 AM _ami_: nn
05:46 AM Haohmaru: i really needed 6 usarts, but those are only available on stm32f0 it seems
05:47 AM Haohmaru: f4 has up to 4 usarts
05:47 AM _ami_: wow, 6 USARTS
05:47 AM _ami_: f1 has 3
05:47 AM _ami_: do you need to high bandwidth too on those usarts as well?
05:48 AM _ami_: if that is not the case, then use a i2c/spi to usart bridge.
05:49 AM _ami_: you could implement soft usart as well since you got lots of pins.
05:50 AM Haohmaru: i think a top rate of 57600 on 4 of the USARTs is the max i'll need
05:50 AM Haohmaru: besides those, i certainly need 1 "fast-ish" syncrhonous usart
05:50 AM _ami_: hmm
05:50 AM Haohmaru: and another one which.. maybe also fast-ish but probably not synchronous
05:52 AM Haohmaru: i was thinking to use another (cheap) mcu that has one USART and a few pins, to do software RX on 4 channels and merge them onto one actual usart and send that to the main mcu
05:52 AM Haohmaru: was looking at stm32f030 (in 20-pin package) for that job
05:52 AM Haohmaru: ~1euro
05:53 AM Haohmaru: i hope 4K ram will be enough to pull off decent usart reception
05:55 AM _ami_: sure.
05:55 AM _ami_: that would work.
05:56 AM day__ is now known as day
05:58 AM Haohmaru: dafuq O_O
05:58 AM Haohmaru: i just saw a emoji in an SMS on my phone
05:58 AM Haohmaru: how is that even possible
05:59 AM Haohmaru: or maybe it's not an emoji but some embedded smiley picture
06:05 AM thardin: you can send emoji in sms, no problem
06:05 AM thardin: but the sms gets limited to 70 characters
06:06 AM Haohmaru: the problem is.. my phone is.. cellular ;P~
06:06 AM Haohmaru: i don't even remember the model, nokia 6200 or something
06:08 AM Haohmaru: no, not that
07:06 AM nohitzwork: does they all have to be usarts?
07:06 AM nohitzwork: or will 4 usarts and 2 uarts do ?
07:11 AM Haohmaru: the four ones can be uarts, even RX-only
07:11 AM LeoNerd: What sort of baud rate? If it's slow enough you can probably do it in software
07:11 AM Haohmaru: i use one synchronous for the tcp-usart pipe module, and another one which is not yet determined
07:12 AM Haohmaru: LeoNerd the four RXs?
07:12 AM LeoNerd: Yah
07:12 AM Haohmaru: 57600 is probably gonna be the fastest i'd want
07:13 AM Haohmaru: btw, is an "instruction" in the flash on these stm32s 32bit big?
07:14 AM Haohmaru: like, if the flash is say 4K that means 1024 "instructions" ?
07:14 AM Haohmaru: on 8bit avr, afaik they are 16bit
07:16 AM nohitzwork: thumb mode 16bit
07:16 AM LeoNerd: On AVR, the flash size quotes bytes, not words
07:16 AM nohitzwork: arm mode 32bit
07:16 AM Haohmaru: LeoNerd i know that
07:16 AM nohitzwork: no learath
07:16 AM nohitzwork: no LeoNerd
07:17 AM Haohmaru: LeoNerd but so, afaik, on xmega128a3u (which is 128K flash) i can haz 64K instructions, right?
07:18 AM LeoNerd: Ish; yes. Don't forget some instructions take two words
07:18 AM LeoNerd: E.g. jumps
07:18 AM nohitzwork: https://discourse-user-assets.s3.amazonaws.com/original/3X/1/c/1c153bc448fee678aafa2b1da31c7485093cdc13.jpg
07:19 AM nohitzwork: but yeah arm has these thumb instructions that are 16 bit
07:19 AM nohitzwork: so it decreases the code size
07:20 AM nohitzwork: https://en.wikipedia.org/wiki/ARM_architecture#Thumb
07:22 AM Haohmaru: yeah, that doesn't count
07:23 AM Haohmaru: NOP is the one and only important instruction!
07:24 AM nohitzwork: thumb-2 is what is generally used, as far as i know
07:25 AM Haohmaru: what does the "arm mode" give you that's worth mentioning?
07:25 AM Haohmaru: fpu?
07:25 AM Haohmaru: simd?
07:27 AM nohitzwork: no its the "old" mode
07:27 AM nohitzwork: yeah these projects default to thumb-2
07:27 AM nohitzwork: fpu isnt dependet on it
07:28 AM Haohmaru: so the new stuff is thumb-2 and instructions are 16bit, kewl
07:29 AM nohitzwork: -mthumb
07:29 AM nohitzwork: -mfpu=fpv4-sp-d16
07:29 AM nohitzwork: truestudio seems to support C++14
07:30 AM nohitzwork: and C11
07:53 AM Ameisen: I have a Clang toolchain working for Cortex M now
07:53 AM Ameisen: well, 95% working
07:53 AM Ameisen: there's a few issues I'm ironing out
07:53 AM Ameisen: though I'm deep in Clang's LTO code to figure this one out
07:53 AM Haohmaru: u sound like a blacksmith
07:53 AM Haohmaru: ironing stuff
07:54 AM Ameisen: does anyone actually use -marm for Cortex M?
07:54 AM Ameisen: everyone I know of just keeps it in thumb mode
08:41 AM rue_: hmm
08:43 AM rue_: CFLAGS += -mcpu=cortex-m3 -mthumb
08:43 AM rue_: thats thumb mode I presume
08:44 AM rue_: whats the main difference?
08:44 AM rue_: haha its 16 bit mode
08:45 AM rue_: Thumb mode allows for code to be smaller, and can potentially be faster if the target has slow memory.
08:45 AM rue_: ""
08:45 AM Ameisen: It's not 16-bit execution mode
08:45 AM Ameisen: thumb just has 16-bit/32-bit instruction sizes
08:46 AM rue_: so, in arm mode, you can fit half the code
08:47 AM rue_: http://embeddedknowledge.blogspot.ca/2012/03/difference-between-arm-and-thumb-states.html
08:48 AM Ameisen: presuming thumb1, and not thumb2.
08:48 AM Ameisen: thumb2 has a few 32-bit instructions
08:48 AM Ameisen: though they aren't fully implemented in GCC or Clang.
08:49 AM * Ameisen already glanced over that and noted that offsets aren't fully calculated for thumb2 yet. //TODO in both GCC and Clang
08:49 AM rue_: right, cause if a something made to be simple isn't as good as the complex thing that its simplifying, you add to its complexity so that it is (like usb being designed for low bandwidth communication, then being expanded to usb3, instead of just using firewire)
08:59 AM rue_: " I dont want a car, I want a bicycle with 4 wheels, heated bucket seats, a 4L engine with a 6 speed transmission, electric windows, 500W 8.1 surround sound system, console computer, and sunroof."
09:01 AM Haohmaru: yeah, but NOT a car, cuz they loud, smelly, and they kill many people each year
09:01 AM Haohmaru: f*ckin cars!
09:02 AM rue_: we have bloatware, so we need to have 16G of ram on a computer so that one application can sop up 5G of ram without there being a performance hit, and we need a 64bit OS to handle it
09:03 AM rue_: anyhow, looks like I use thumb mode
09:03 AM polprog: -mthumb kinda gives it away ;D
09:04 AM rue_: I need to make a widget
09:04 AM polprog: for what
09:04 AM rue_: a little handheld thing with ethernet jack
09:05 AM rue_: you plug it into a wallplate, it tells you if there is link, if there is dhcp (what address it got) and if it can ping google
09:05 AM polprog: hmm
09:05 AM rue_: (or some fixed ip)
09:05 AM polprog: kinda like a cable tester but for layer 2
09:05 AM polprog: sounds very useful
09:06 AM rue_: 8.8.8.8 is pingable
09:06 AM rue_: I have earmarked an stm32 and a ethernet module for it
09:06 AM rue_: I also have a little 1" lcd
09:06 AM Haohmaru: wiznet? ;P~
09:06 AM polprog: i always ping 8.8.8.8 then google.com to test DNS resolution as well
09:07 AM rue_: I dont know what we do if google folds
09:07 AM Haohmaru: why google?
09:07 AM polprog: well that and facebook are probaby the biggest two internet companies
09:07 AM rue_: cause if google were on the brink of bankrupcy, the world would HAVE to bail them out
09:07 AM rue_: facebook!?
09:08 AM rue_: ugh
09:08 AM polprog: you can safely assume their servers are reachable any time
09:08 AM polprog: yeah ugh.. the amount of shit there
09:08 AM rue_: I cant quite imagine the ripple of google shutting down
09:09 AM polprog: and facebook doesnt have an easy to remember ip address, so 8.8.8.8 is pretty handy to ping
09:10 AM rue_: so, are there any sites using ipv6?
09:10 AM polprog: 10 am on the east coast rn
09:10 AM polprog: wonder if theres anything worth watching on TV
09:11 AM rue_: watch me put my garbage out, I dont know what channel its on, prolly satillite ;)
09:11 AM polprog: i remember i was watching CBS when there was the hurricane in florida
09:11 AM Haohmaru: rue_ the NSA watches you, smile!
09:12 AM rue_: ye, I just cant work out which of the 182 processes running on my machine is behind it
09:13 AM Haohmaru: the NSA process bounces around from service to service
09:13 AM rue_: I suppose i just look for the mandatory free automatic upgrades
09:13 AM polprog: what system ? win 10?
09:13 AM Haohmaru: wuauserv.exe >:)
09:14 AM rue_: debian
09:14 AM polprog: nice
09:14 AM polprog: i like debian
09:14 AM Haohmaru: eh? debian doesn't do that
09:14 AM polprog: yeah
09:14 AM Haohmaru: debian + lxde ftw
09:14 AM polprog: i have debian and xce
09:14 AM polprog: xfce
09:14 AM rue_: I installed this machine in ~2002
09:15 AM rue_: its my longest running install ever
09:15 AM rue_: dont know how I'm gonna upgrade to 64 bit witout a reinstall
09:15 AM polprog: its definitely possible with some apt sorcery
09:15 AM polprog: but not worth it
09:15 AM polprog: i assume its a 64 bit machine
09:16 AM polprog: from 2002. wow
09:16 AM rue_: no, lots of hardware and software upgrades
09:16 AM rue_: but no reinstalls
09:17 AM rue_: so what are the compeditors of opencm3?
09:21 AM polprog: lol https://puu.sh/zN7Zp/9c248e9ae1.png
09:21 AM polprog: whats going on in there
09:40 AM nohitzwork: weekend...starts here
09:40 AM nohitzwork: https://www.youtube.com/watch?v=y1DUKZapCOc
09:40 AM nohitzwork: see ya
09:41 AM polprog: didnt know this track by fatboy slim
09:42 AM polprog: mmm acid
09:42 AM Haohmaru: pewpew
09:43 AM polprog: get a blast from the past
09:43 AM polprog: https://www.youtube.com/watch?v=E4KTsdDTiDs
09:44 AM polprog: that 2000 computer graphics
09:44 AM polprog: tbt 303 <3
09:45 AM polprog: tb-303 *
10:54 AM Apocx_ is now known as Apocx
12:20 PM Ameisen: time to start working on uflib
12:21 PM Ameisen: gonna have two branches, maybe three, of functions
12:21 PM Ameisen: ::fast, ::small, and maybe ::tiny
12:51 PM nohitzzz2: whats that
12:53 PM Ameisen: replacement for libc
12:54 PM Ameisen: most embedded stuff really doesn't need a full libc
12:54 PM Ameisen: and if you add more constraints, it gets smaller and faster
12:54 PM Ameisen: however, there are algorithms that are larger and faster, and ones that are slower but smaller
01:06 PM nohitzzz2: newlib-nano
01:06 PM nohitzzz2: its an option in truestudio
01:16 PM Ameisen: newlib-nano is still huge compared to what it should be.
01:43 PM nohitzzz2: here's my first C program for C64 https://pastebin.com/fELwQqeQ
01:44 PM Emil: God damn it's annoying getting an environment ready
01:44 PM Tom_L: oh suck it up and stop yer whinin....
01:45 PM Emil: :{
01:45 PM Emil: I also managed to bork my ssh connection D:
01:48 PM Emil: Tom_L: polprog https://emil.fi/d/spin_latest
01:49 PM polprog: Emil: hope its not meatspin
01:50 PM Emil: :d
01:50 PM Emil: :DD
01:50 PM polprog: hmm nice
01:50 PM Emil: I should do that
01:50 PM polprog: a linux makefile
01:50 PM Emil: And make it "random"
01:50 PM polprog: haha :D
01:50 PM polprog: useful!
01:52 PM Emil: polprog: well it doesn't work
01:52 PM Emil: and qemu shouldn't need sudo
01:52 PM polprog: ouch
01:52 PM Emil: polprog: the downloading and compiling part work
01:52 PM polprog: indeed it should not
01:52 PM Emil: but building initramfs and then running it don't
01:54 PM polprog: damn i had a link to a guide on compiling a minimal kernel
01:54 PM Emil: I probably have it open
01:59 PM polprog: can find it
01:59 PM polprog: cant*
02:01 PM polprog: so whats the error
02:01 PM polprog: i dont think i remember much from t
02:02 PM polprog: from when i was messing around
02:06 PM polprog: yes yes yes
02:06 PM polprog: http://mgalgs.github.io/2015/05/16/how-to-build-a-custom-linux-kernel-for-qemu-2015-edition.html
02:06 PM polprog: found it
02:06 PM polprog: :)
02:07 PM Ameisen: stupid clang, with its __builtin_constant_p not able to determine that a function argument is constant
02:09 PM polprog: i should download some MGS to see what its all about
02:44 PM chat is now known as Guest89243
03:34 PM Emil: polprog: yeah I have that open
05:11 PM polprog: Had codeblocks crash on me 4 times when immmm
05:12 PM polprog: this hour*
05:12 PM polprog: did i mention touchscreen keyboards suck
05:13 PM antto: what have i always said about touchscreens? >:/
05:13 PM antto: y u no listen
05:14 PM polprog: id love to have an e90 communicator but unfortunately the world doesnt like them
05:15 PM polprog: ill have to work on the backend site that has to gracefully receive incoming serial data and signalize the gtk gui (which will have to be written as well) to update the plot
05:16 PM nohitzzz2: i bought one few months ago
05:16 PM polprog: s/site/side/
05:16 PM polprog: i have one
05:16 PM polprog: "bought"
05:16 PM polprog: why
05:16 PM nohitzzz2: why not
05:16 PM nohitzzz2: i collect old nokia phones
05:17 PM * polprog actually didnt expect an answer and became frozen
05:17 PM polprog: h#+/!NO CARRIER
05:19 PM antto: +++ATH0
05:19 PM * antto runs
05:22 PM polprog: msg nickserv identify hunter2!
05:23 PM Casper: I always wanted to try +++ATH\natd911\n I'm pretty sure it would actually work...
05:23 PM Casper: polprog: why do you use stars as your password?
05:24 PM antto: i had learned some way to send +++ATH0 thru my modem without it hanging up
05:24 PM Casper: I used to have a button in xchat that was sending that +++ath0\n ping...
05:25 PM Casper: antto: suposelly there was an easy fix for that
05:25 PM Casper: an extra init parameter
05:26 PM polprog: Casper: what for
05:26 PM Casper: the parameter? to actually tell it to wait for a delay before accepting the +++
05:26 PM polprog: antto: iirc the escape sequence had to be entered without any pause
05:27 PM Casper: actually, not quite
05:27 PM polprog: Casper: why would you need such a button
05:27 PM antto: i don't know the detail, but i remember i was touching some stuff in the modem settings
05:27 PM antto: it's probably still there on my win98SE machine
05:27 PM Casper: the official specs say there should be a 2 seconds of silence before it accept the +++
05:27 PM polprog: i dont know, im too young to have a serial modem
05:27 PM antto: ah, no, it won't be
05:27 PM Casper: lots of modems just did not wait, and was vulnerable
05:27 PM polprog: maybe i should get a pair of them
05:28 PM antto: don't u have a GSM
05:28 PM polprog: to get long range serial comms
05:28 PM antto: get a quectel M95 and suffer
05:28 PM Casper: so if you were sending "foobar+++ath0\n" it disconnected... it should have been: "foobar(>=2sec no transmit)+++ath0\n"
05:29 PM antto: i think you need pause after the +++
05:29 PM antto: if you want to prevent the ath0 from taking effect
05:37 PM polprog: you should have had a button that initiates a CTCP transfer on port 0
05:37 PM polprog: iirc that used to knock out some home routers :D
05:40 PM polprog: or did it
05:40 PM polprog: ?
05:40 PM polprog: i remember i found something like that
05:40 PM polprog: a cve
05:42 PM hetii: Hi ;)
05:42 PM nohitzzz2: hi
06:00 PM polprog: hey
06:18 PM Emil: polprog: port 0 should result in "random" port
06:19 PM polprog: i dont remember really
06:20 PM polprog: but i know it was with sone routers getting funky with port 0 direct connections
06:49 PM abcabc_: anyone awake? i discovered avr-gcc 4.8 makes arduino optiboot bootloaders 540 bytes long, 4.5, 498. is there a fix?
06:50 PM Tom_L: revert to 4.5
06:50 PM abcabc_: i did... but is there a fix? what changed?
06:51 PM polprog: gcc is getting worse at code gen for avrs since some time
06:51 PM polprog: to answer your question, gcc changed :)
06:52 PM polprog: niters
06:52 PM abcabc_: another project i am working on builds to 126xx bytes with 4.8 and 128xx with 4.5 ...
06:54 PM abcabc_: i'll compare the lss files for the bootloaders. the app is too big.
06:58 PM rue_: maybe gcc is just giving way to clang
07:34 PM chat is now known as Guest47969
08:19 PM Rez is now known as LoRez
09:45 PM _ami_: good talk about FPGAs here: https://www.youtube.com/watch?v=kESljxjnzTM&feature=youtu.be
09:45 PM _ami_: live right now!
09:52 PM rue_: which brand?