<crest> tp: compiling the m3 disassembler from a file into sram takes about 1.424 seconds on my laptop with swdcom
<crest> uploading an empty file takes 0.011 seconds
reepca has quit [Read error: Connection reset by peer]
reepca has joined #forth
<crest> this is without comment stripping
<crest> tp: would you be willing to run a comparison on your setup with a 400k baud serial and hardware flow control?
<tp> bak
<tp> crest sure
<crest> oh that's with my slower fallback swd-key
<tp> crest, the m3 dissasembler upload seemed a bit slow
<crest> why?
<tp> crest, I'll set up here to properly time things
<crest> i timed with the zsh time builtin
<tp> 1.4 seconds seems slow but I dont have any hard timings yet
<crest> i don't expect much difference
<tp> I trued timing with screen but it didnt work for some reason
<tp> crest, have you updated your repo ?
<crest> that's what i was doing before you replied
<tp> cool, ill try it shortly
<crest> committed and pushed
<crest> for now you have to use i/o redirection to use regular files and pipes
<crest> e.g. swd2 $add < foo.fs
<tp> thats no problem
<crest> i want to add a better interface
<crest> but before that i have to cleanup the code a little more
<crest> adding support for pipes and regular files made a mess out of produce()
<tp> there isnt a lot of code there
<crest> ?
<crest> did you execute "git pull"
<tp> i havent got to it yet
<tp> how do you access swd from your code, it's a mystery to me
<tp> I dont see any swd memory maps
<tp> i mean the SWD interface
<crest> ?
<tp> youre talking to the chip via the SWD interface ?
<crest> yes
<tp> yet swdcom seems not to know anything about the swd peripheral ?
<crest> i reuse the existing code in libstlink-shared.so from the stlink package
<crest> all my code does to talk to the stm32 through the stlinkv2 is call a few library functions
<crest> stlink_open_usb() to get a handle to the stlinkv2
<tp> ahh and the target micro just responds to the swd programmer ?
<tp> because it's hardwired to do that
<crest> the debugging hardware inside the blue pill (or other target) responds to the stlinkv2
<crest> there is no setup needed because the defaults are to allow debug access
<tp> I'm using a STMicro F0 Discovery here, I'm not using a blue pill
<tp> and it works perfectly
<crest> as long as you have 2 * 256 + 4 bytes of sram for the buffer it should work
<tp> the F0 has 8KB of ram
<tp> I'll measure the free ram before after swdcom is installed nextime
<crest> in that case dedicating 516 byte to i/o buffers hurts a lot more
<tp> cortex-m units have plenty of ram
<tp> nah, it's not a problem for me
<tp> i never run short of ram
<crest> techs and their puny code bases :-P
<tp> Mecrisp-Stellaris takes abut 1.5KB of the ram
<tp> yeah, I just make real world things work, I'm not generating bitcoins on my micro
<tp> I designed and sold a bunch of solid particulate level detectors about 20 years ago that used a PIC micro with 1K flash and 78 bytes of ram. I had plenty of each left over
<tp> those units were still in use a decade later
<crest> why change a working system?
<crest> you can think of the ring buffers of the two arrays they are
<crest> and my swdcom as a special purpose debugger
<tp> crest, almost 3am again!
<crest> it just polls one of the array and writes to the other
<tp> crest I've githubbed and I'm setting the test up with your new code
<crest> this version shouldn't transpose your source code in garbage
<crest> (during fast uploads)
<tp> nerly ready to test
<tp> it takes me a while because I have to reflash a new Mecrisp-Stellaris, edit your code, load it, make a binary then test
<tp> Ram Total:8192 Used:2080 Free:6112
<tp> Mecrisp-Stellaris RA 2.5.3 with M0 core for STM32F051 by Matthias Koch
<tp> The swd buffer address is: 20001D58
<tp> ok.
<tp> --- Mecrisp-Stellaris RA 2.5.3 ---
<tp> words4
<tp> 2over 2tuck 2rot 2-rot
<tp> 2dup 2drop 2swap 2nip
<tp> 2>r 2r> 2r@ 2rdrop
<tp> looks as fast as beore
<tp> :)
<crest> i did nothing that should make it slower to fix the bug
<tp> Ill try a file upload
<tp> will I need to exit the terminal first ?
<crest> yes
<crest> you have to press ctrl + d to get out of swd2 correctly
<tp> oh
<crest> ctrl+c isn't caught and kills swd2 without a clean shutdown
<crest> this can cause problems the next time
<tp> it's probably a cooincidence but I note that stlink no longer works on this machine, Ive had to flash via serial bootloader
<crest> it could be stuck because you killed swd2 the "wrong" way
<crest> if it writes a core file the stlink hasn't been properly released
<crest> but in the last version killing it the wrong way was the only way
<crest> because the correct ways hadn't been implemented yet
<tp> aha
<tp> serial is at least a easy way and works with openindiana
<crest> i don't know if there is a good way to recover from this without unplugging the stlink
<tp> but youre right, open solaris is dead
<tp> looks like I'll stay with freebsd, I think it's the only choice now
<tp> (if one must have ZFS)
<tp> unplugging is no problem
<crest> zfs on linux is a thing
<tp> not bootable zfs
<crest> it's possible
<tp> openzfs is incompatible with the gpl
<crest> not a problem
<tp> yeah, it's possible to mate a horse and a donkey but not easy
<crest> you're just not allowed to distribute the result
<tp> have you converted a Linux distro to bootable openzfs ?
<tp> it's not trivial
<crest> no but i know several people booting arch from zfs for years
jedb has joined #forth
<tp> yeah but arch users are used to that kind of stuff
<tp> your average debian user would find it daunting
<crest> my opinion of the average debian and ubuntu user isn't printable
<tp> sure having ZFS filesystems in Linux is trivial, they have packages for it
<tp> hahah
<tp> Closing ST-LINK/V2 handle.
<crest> that sounds good
<tp> swd2 $add < gcd.fs
<tp> add: Undefined variable.
<tp> hmm why is $add there ?
<crest> it should read $addr
<crest> its the base address of the buffer printed to the serial console before the switch
<tp> oh! <doh>
<tp> wow that uploaded fast
<tp> i had a lot of comments in that file
<crest> what did you try?
<crest> just a small gcd function?
<tp> I had errors because of a missing ms.counter.reset which I didnt see of course
<tp> but when I opened swdcom terminal I saw them
<crest> compiling to flash raises the upload time from 1.3 seconds to 1.8 seconds for the m3 disassembler
<tp> i only uploaded into ram
<tp> compiled to ram rather
<crest> writing to flash slows down the compiler a little
<tp> i always do that first and during dev
<tp> yes
<tp> but thats not swdcoms fault
<crest> of course not
<crest> it is fast enough to expose the flash as bottleneck
<tp> and the m3dissasembler has a lot of stuff to compile
<tp> yes, flash is always the slow part
<tp> it's better to use ram in measurements as flash varies between mcu's also
<crest> it is one of the largest forth files in the mecrisp stellaris release
<tp> it is
<crest> i wanted to know by how much it slows down uploads
<tp> I rarely load the m0dissasembler as it takes up so much space in my tiny stm32f051
<crest> about 10k for the m3 disassembler
<tp> yeah
<crest> proving how complex the damn thumb2 isa is
<tp> but I only load what I need
<tp> well anything with a lot of text takes up space
<crest> it's a good that thing that risc-v is so boring compared to that
<crest> just about 50 instructions for the base isa
<crest> with a lot fewer special cases
<tp> my next version of svd2forth will separate the text legends from the memory maps to save space
<tp> it is really boring, just reading source put me to sleep
<crest> but for now swdcom is useable
<tp> it sure is!
<crest> even if there are a lot of possible improvements on my mental roadmap
<tp> i may send your name to the Nobel Committee for this!
<tp> be really nice to get the errors back when uploading <hint, hint>
<crest> that's close to the top
<tp> Ive made a bootable binary with your latest swdcom for the F0
<tp> as much as I dont care I should ask do you want to do anything about the Linux issue with compiling swd2.c ?
<crest> yes
<tp> maybe make and distribute a Linux binary swd2 ?
<crest> the patch to fix everything tabemann mentioned should be between 10 and 20 lines
<tp> if you do then I can put swdcom on my website for people to try *if you want* ?
<tp> and then you can get feedback *if you want(
<crest> i just need a linux tester
<tp> only one ?
<crest> yes
<tp> you may get a few if it's on my website
<tp> I have 47 readers ;-)
<tp> oops 42
<crest> and it looks like tabemann volunteered
<tp> he had a good try and discovered what crap debian is nowadays
<tp> your uploader is pretty spectacular
<crest> the package maintainer probably never tried to use the shared library to compile anything from outside the package
<crest> it gets the job done
<tp> probably a non coder like me with zero clue
<crest> but relies on a tiny patch of the forth kernel
<crest> to inject a ACK to "ok. " in quit
<tp> I can put that up with a article about swdcom also if you like
<crest> and a NAK to all compiler errors
<crest> as long as you warn your readers how sharp the edges are
<tp> that will make tabemann happy he loves ack/naks
<tp> it's your choice, this is your development
<tp> warn Forth users aboyt sharp edges ... really ?
<crest> not really. i put it on public github repo
<tp> if anyone is impervious to sharp edges it's Forth users
<crest> sure but this one just a proof of concept so far
<tp> like most forths :)
<crest> there is no way to upload files without disconnecting the interactive console yet
<tp> i must say swdcom is looking pretty robust so far
<tp> and thats still ok as long as errors can be seen during upload
<tabemann> hey guys
<tp> hey tabemann, I just tested the latest swdcom doing a Forth source upload .... fast!
<crest> tp: that's what happens handle all errors returned by library functions
<crest> *when you handle
<tabemann> tp: cool!
<tp> tabemann, but beware, swdcom may set your pc on fire, curdle your milk and make your curtains turn yellow!
<tabemann> lol
<crest> tp: i just don't want to disappoint potential users
<tp> tabemann, I also have swdcom running on a F0 Disco, piece of cake!
<tp> tabemann, all it needs is a usb connection to the SWD programmer section of the board for a fast terminal
<tp> tabemann, kind of like a USB virtual terminal, except it's connected to the SWD programmer and the FO Disco MCU has no USB
<tp> crest, lets call then 'beta testers'
<tp> I'm a SWDCOM 'beta tester'
<crest> there is no beta (yet)
<tp> it's very refreshing not to have to worry about EOL delays
<tp> Im a ceta tester
<crest> this is my dev system
<crest> a stlink clone hooked up to the swd connector of a blue pill board
<crest> how well do you know the stm32 usarts?
<crest> are all the registers writable?
<crest> or are there a read only registers?
<tp> let me show you ?
<crest> i'm asking because i'm wondering if would it be possible to bootstrap by writing to the usart registers
<crest> use the stlink to write to the usart registers
<crest> and let serial-key? and serial-key read them into the compiler
<crest> MUHAHAHA
* crest evil laughter
<tp> wow, thats a evil thought!
<tabemann> hey!
<tabemann> I got it to build with: gcc -O0 -g -I/usr/local/include -L/usr/local/lib -o swd2 swd2.c -lstlink
<tp> crest your home setup is pretty horrible
<tabemann> with CLOCK_UPTIME_FAST replaced with CLOCK_MONOTONIC_COARSE
<tp> tabemann, awesome!
<tabemann> and #include <sys/endian.h> replaced with #include <endian.h>
<crest> did you pick the latest version form half an hour ago?
<tp> tabemann never gives up!
<crest> because the version from last night had data corruption bug
<tabemann> crest: yes
<tp> tabemann, and quit the terminal with ctrl-d or your pc will explode
<tp> tabemann, ctrl-c will make the pc explode
<crest> it won't explode
<tp> ok .. catch fire
<crest> at worst you have to unplug the stlink
<crest> and reconnect it to get it working
<crest> and only because i don't know how to reset the debugger without resetting the target
<tp> crest, which I had to do the first time I ctrl-c the terminal
<crest> i hope that it's possible
<tp> crest I also remove your 'reset' as the last command as init will take effect after the board is reset
boru` has joined #forth
boru has quit [Disconnected by services]
<tp> crest, that way I can build a binary before I reset the board
boru` is now known as boru
<tp> crest, pLus all your clock stuff is extranious and mcu dependent, I remove all that as my mcu has all that set up anyway
<tp> crest, for instance tabemann's mcu will be set up to do 120mhz
<crest> i wanted everything to bootstrap from a mecrisp stellaris 2.5.3 stm32f103-ra image to swdcom in a single file
<tabemann> back
<crest> and sure it works with the default 8mhz
<tp> crest, sure, but why limit swdcom to a old obsolete F103 ?
<crest> because its all i have available for testing
<crest> *it's
<tabemann> you can always get more DISCOVERY boards
<tabemann> the two DISCOVERY boards I own costed like $25 each
<tp> crest, so just use the default 8mhz ?
<tp> crest, only windows users have blue pills
<tp> ;-)
<crest> tp: i'm not falling for that
<tp> crest and Do you know wether you *actually* have bonafide F103's in that board ?
<crest> no
<tp> crest, it's true, 60% of my blue pill diags binary are windows users
<tp> i have stats to prove it
<crest> i have some mystery chip on a board that cost less with shipping in packs of 5 than 5 chips should cost
<tp> yeah, Chinese clones
<tp> Chinese clones that arent 100% compatible
<crest> according to the datasheet the RXNE bit can only be cleared
<crest> that puts an end to my evil plat to bootstrap that way
<tabemann> back
<tabemann> my question is that, unless one is manufacturing products in volume, why care about whether they are cheaper than dirt
* tabemann does not miss the money he spent on his two DISCOVERY boards
<crest> because i didn't know what i wanted do with them before i ordered them
<tabemann> whereas I'd be so pissed if something broke, and after spending hours debugging it, it turned out to be due to some cheapass chinese clone
<crest> i just had the general idea that i wanted to play with arm boards
<crest> and they're small throwaway computing units
<tabemann> whereas I had the specific aim of creating a Forth implementation targeting these chips
<tp> crest if you dl and run my binary you can determine what chip you have: https://mecrisp-stellaris-folkdoc.sourceforge.io/stm32f1xx-diagnostics.html#stm32f103xx-diagnostics
<tp> crest, the F103 is 16 years old, it's a obsolete cortex-m
<crest> thx for telling me ...
<crest> ... again
<crest> what would you recommend as replacement?
<tabemann> get an L476 or an F407
<tp> hahahah
<crest> total overkill
<crest> what's the difference between the two?
<tp> crest, there are hundreds of cortex-m from the smallest and slowest to monsters, how can anyone advise you, it depends what your requirements are
<tabemann> L476 is lower power, with a whole power control system, whereas F407 is fast
<tp> for a start, the latest stuff is the "G" series, tabemanns gear is obsolete already
<tp> the G embodies the best of the F and L range
<tp> $3 gets you a 200+ pin MONSTER G mcu
<tp> 208 MHz
<tp> 2MB flash
<tabemann> you can't argue with that for 3 bucks
<crest> something small and cheap enough to leave in projects, supported by mecrisp stellaris
<tp> or in my case I paid $0.65 each for 480 STM32F051's in 2014
<crest> and i don't want to run out of resource too quickly while learning
<crest> lets say at least 32kB ram and 128kB flash
<tabemann> me doesn't regret buying getting MCUs with 1 meg flash
<tabemann> whoops
<tp> lol, Ive been learning the peripherals of my STM32F051 since 2016 and Im only about 60% proficient
* tabemann doesn't regret getting MCUs with 1 meg flash
<tp> tabemann, is right, the extra flash is a bonus when learning
<tp> crest, any cortex-m is supported really, but if it's not on that list then you may have to set up the flash and the serial port
<tp> unless you use swdcom!!!
<tp> then you may still need to code the flash support in assembly
<tp> crest, how about a STM32G071RB
<tp> it's a cortex-m0
<crest> the NUCLEO-F446RE is available for 17€
<crest> with 512kB flash and 128kB sram
<tp> and it will *utterly* blow the blue pill away in every area
<crest> but it's not on the list
<tp> then there is no ready made Mecrisp-Stellaris for it
<tabemann> really, coding up support for a new arch in mecrisp-stellaris is pretty simple
<crest> scnr
* tabemann versteht nur ein bisschen Deutsch
<tp> haahh a f103 nucleo, youd have to be mad
<tp> I have no problems with long urls
<tp> crest, the F4 seris are the heavy duty MCU's they are faster, bigger, much higher end
<tp> I dont need them for any of my real world projects
<crest> but how much harder are they to configure?
<tp> no harder
<tabemann> the only real disadvantages to the F4 are if you want lower power or you want nicer flash erasure characteristics
<tp> just more of everything
<crest> are there breakout boards to allow people to play with them
* tabemann finds the L4s and the F4s to be equally easy to configure
<tp> and tabemann is the F4 expert here
* tabemann hates the F4's huge flash sectors
<tp> crest, any discovery or nucleo board is a breakout board
<tabemann> both of my DISCOVERY boards come with loads of pins to attach things to
<tp> crest, they are all easy once one gets used to cortex-m
<tp> the f0 series are for small projects that only need 33 onboard peripherals bwah!
<tabemann> fundamentally the main things that differ between Cortex-M chips are A) the flash controller B) the U(S)ARTs C) whether they support thumb-2 and D) how much flash and RAM they have
<tp> a F7 has 97 thats *NINETY SEVEN* onboard peripherals !
<tp> tabemann, has summarised it very succinctly
<tabemann> and yes, whether they have fuckloads or fuckloads upon fuckloads of peripherals
<tp> hahah
<tp> STM32F7x7 93 peripherals2093 registers17051 bitfields
<tp> one cant even visualise ho many bitfields 17051 are
<tabemann> this is what svd2forth exists for
<tp> exactly
<tp> tabemann, my next version separates the pretty printing parts from the memaps so a user can choose what they want to save space
<tabemann> HAHA
<tabemann> it's alive!
<tabemann> crest
<tabemann> I got swdcom working with zeptoforth!
<tp> how awesome!!
<crest> tp: is there anything wrong with a NUCLEO-F401RE?
<tp> crest I'm getting the datasheet now
<tp> ARM® Cortex®-M4 32b MCU+FPU, 105 DMIPS,
<tp> 512KB Flash/96KB RAM, 11 TIMs, 1 ADC, 11 comm. interfaces
<tp> looks fairly standard, older model (like tabemanns gear ;-)
<tp> $13 tho :)
<tp> it's a massive bargain compared to a blue pil
<crest> i can get a NUCLEO F411RE for the same price
<tp> also has a SWD programmer at one end like all disco/nucleos
<tabemann> blue pills're cheaper, but with cheaper you get fewer features and worse quality
<tp> and no swd programmer
<tabemann> yeeah
<tp> fewer pins
<tabemann> you want the integrated swd programmer
<tabemann> so you can just hook up your board with USB
<tabemann> and program right away
<tp> they only exist for windows users like crest ;-)
<tabemann> without fussing with an external SWD programmer
<tp> yeah, but how will crest survive without arduino for the bluepill ???
<tabemann> tp: well, for a windows user I am impressed by swdcom - lol ;)
<tp> for many hobbysists arduino is a lifeline
<crest> i haven't installed the arduino in over a decade
<crest> and hated it back than
<tabemann> we're not being serious, crest
<tp> sorry crest, I'm joking, youre a l33t hacker to me
<tabemann> but seriously, swdcom is niice
<crest> i just want something that will run mecrisp without porting
<tp> tp programming level - 1 ; crest programming level - 1000+
<crest> because i don't want to spend time on that
<tp> crest that NUCLEO-F401RE? will absolutely rin Mecrisp-Stellaris withut porting
<tabemann> crest: there's tons of chips and boards mecrisp supports
<crest> supporting the register allocator would be nice as well
<tp> tabemann, crest has the supported hardware list
<crest> is there a reason why so few targets have a -ra suffix
<tabemann> or you could always invest in an L476 or F407 and install zeptoforth ;) ;) ;)
<tp> only that the binary hasnt been made for that chip, it's a compile time option
<crest> ok
<tp> as Mecrisp-Stellaris comes with premade and ready to run binaries
<tabemann> and getting the toolchain for arm-none-eabi is easy if you run linux or freebsd
<tp> yeah it all works with FreeBSD
<tp> including making a binary for Mecrisp-Stellaris
<tabemann> (unlike getting the toolchain for risc-v, which is an absolutely massive pain in the ass)
<tp> tabemann, tried uploading a Forth sourcefile cia swdom yet ?
<tp> swdcom
<tabemann> tp: do I use #include like e4thcom?
<tp> tabemann, like this: ./swd2 20001D58 < gcd.fs
<tp> tabemann, kill the terminal first
<tp> tab, no it's still a ceta release
<tabemann> ceta?
<tp> before beta ;-)
<tabemann> that's alpha
<tp> oh...
<tp> Im a technician, no one told me bwahahahah
<tabemann> lol
<tp> I'm the hardware guy
<crest> tp: looks like i'm gettin two NUCLEO F411RE boards in case i break one
<tp> crest, re the F411RE, as it's a older unit it has older flash
<crest> than the 401?
<tp> and the older flash is SLOW to flash compared to the L476
<tp> but the board is solid and proven
<tp> the MCU is solid and proven, just older
<crest> with 128kB sram i can keep enough code in sram to keep me busy for a while
<tabemann> now I've got my board displaying blinkenlichten, all thanks to swdcom
<tp> tabemann :)
<crest> tabemann: good to hear that the code works for you
<crest> feel free to send a pull request
<tp> tabemann, your impression re speed of upload, terminal response etc ?
<tabemann> tp: very, very fast
<tp> crest, is a legend!
<tabemann> despite the fact that no comments or whitespace were being taken out of the code
<tp> yes!
<tp> crest, some of the boards have a lot more ram
<tp> tabemann whats in the L476 ?
<tp> oh same 1 Mbyte of Flash memory, 128 Kbytes of RAM
<tp> in LQFP100 package
<tp> crest, the older flash also has much larger blocks compared to the L476
<crest> so you would recomend to spend 1€ more on a NUCLEO L476RG
<tabemann> hmm my code seems to indicate it has 96K of RAM, even though I thought it had more
<tp> tabemann, crests code would run on Zeptoforth methinks ?
<tp> tabemann, with a bit of tabemann massaging
<tabemann> eyes
<tabemann> whoops
<tabemann> yes
<tabemann> it is runningo on zeptoforth, with some massaging
<tp> oh1
<tp> you ran it on zeptoforth instead of Mecrisp-Stellaris ?
<tabemann> yes
<tp> hahah, you could have mentioned that!
<crest> i think he did
<tp> we assumed you meant you had it running on Mecrisp-Stellaris
<tp> oh, I must have missed that, apologies
<tabemann> there's a single disadvantage to using swdcom - it feed literally every character entered into zeptoforth
<tabemann> and zeptoforth, well, can we say it doesn't really filter its input
<tabemann> it'll echo every character entered aside from DELETE and CR
<tabemann> and it will put the character in its input buffer
<tabemann> verbatim
<tabemann> feeds*
<tp> tabemann, but you dont see any of that with swdcom atm
<tabemann> tp: mecrisp-stellaris probably more strictly filters the characters entered
<tabemann> I should program that into zeptoforth
<tp> tabemann, Mecrisp-Stellaris does filter comments
<tabemann> no, I mean like characters < $20
<tabemann> control characters
<tp> but filtering comments takes time which is why I strip them automatically before upload
<tabemann> no I mean when the user is interactively using the terminal
<tabemann> and say, they hit up
<tabemann> with zeptoforth, the cursor will literally go up one line
<tabemann> and the control characters will be entered in the input buffer verbatime
<crest> i went with the STM32L476RG
<crest> 1MB flash and 128kB ram for my crazy ideas
<tp> tabemann, ahh thats why my terminal is almost unusable with Zeptoforth @
<tp> crest, a very excellent choice!
<crest> tp: my debugger attack on the serial-key? and serial-key should be possible
<crest> i just have to put hardware breakpoints at their addresses
<tp> crest, the STM32L476RG is not too old, has all the cool low power stuff and a zillion resources
<crest> load the data into the registers and skip the program coutner over the status register reads
<crest> but that would be a lot harder to implement than just putting data into writable memory mapped i/o registers
<tp> crest, aNd faster ?
<crest> than what?
WickedShell has quit [Remote host closed the connection]
<tp> your existing swdcom technique ?
<crest> no
<crest> probably orders of magnitude slower
<crest> but it would be possible to inject the bootstrap code into an unmodified image that way
<tp> oh
<crest> its not useful
<tp> so you can load swdcom remotely ?
<crest> you could load the target code into the target through the stlink
<tp> aha
<crest> it's just my curious hacker mindset that send me down that path
<tp> tho Ive worked around the issue of needing a serial terminal to load swdcom by making a bootable binary and the address by blinking the disco board leds
<crest> writing the four functions in assembler would also solve the problem
<tabemann> back
<crest> but i wanted to do it in forth
<tp> crest, so a future swdcom may install itself ?
<crest> maybe
<tp> hackers are definitely a breed apart from us mortal electronics techs :)
<crest> i know next to nothing about the analog world just next to the mcu
<tp> one cant be a expert in both fields, just one is more than enough
<crest> can someone tell me what happens in a stm32 on reset?
<crest> what does the chip do on reset?
<crest> is there some code in mask rom to bring the hardware into a sane state?
<tp> sure, a lot happens
<crest> is it a hardwired state machine?
<tp> in that url I pasted earlier of USART1 it showed the reset state of every register
<crest> but how does it get into reset state?
<tp> it resets all the registers to the reset state
<crest> but how?
<tp> there are a number of ways, the technical manual for the mcu explains everything
<crest> are those all set-reset registers hooked to a single reset line?
<tp> no one knows *how* it's done
<crest> someone at ST should know
<tp> all the interrupt vectos are set
<tabemann> back again
<tp> vectors
<crest> but it sounds like i shouldn't hope to be able to protect the usb controller from resets
<crest> and revive the usb modem idea
<tp> and in your new STM32L476RG there are probably 100+ interrupt vectors
<tabemann> what I do is load all the setup code initially via serial, and either export it via ihex to a binary or just use it as is, and then load the swdcom code when it's all done
<tp> crest, resets happen under controled circumstances such as pressing the reset button, low power voltage, hard exception
<tp> crest, but otherwise wont happen
<tabemann> as long as one avoids those situations, one should be fine
<tabemann> and also, at least in zeptoforth, the location of the buffer won't change across reboots
<crest> is there any electrical connection between the two parts of a nucleo board?
<tp> tabemann, I've already made a bootable Mecrisp-Stellaris binary with swdcom using my ihex method
<tp> crest, sure, the power, swd etc
<tabemann> tp: then you just need to record down that magic address somewhere
<tp> tabemann, I've written a alpha level word that blinks the board led to convey the swdcom address
<tabemann> in binary? lol
<tp> no, in decimal, like a car fault code led
<tp> it's easy to do'
<tp> short flashes for 1 - 9 and a long flash for 0
<tabemann> you could do morse code
<tp> then youd have to know morse, I already know decimal
<tp> it blinks, you count them, you write them down, it's easy
<tabemann> with morse code one could do hexadecimal
<crest> sure he could also use a DAC to output each digit as $x * 100mV for one second
<tp> and you only have to do it once
<tp> crest, thats also a idea :)
<tp> but watching the led requires no aditional gear
<tabemann> with zeptoforth and swdcom, you just attach a serial terminal first then boot
<tabemann> and the address is right there on the serial terminal
<tabemann> no counting involved
<crest> if you rewrite the code in assembler you can make it part of the image and extract the location from the symbols file
<tp> it's already a bootable binary
dave0 has quit [Quit: dave's not here]
<crest> unless zeptoforth is fastly different
<tp> tabemann, I'm trying to use a method that requires no serial terminal
<tp> tabemann not everyone has a serial dongle
<tabemann> that is true - the age in which every machine came with a serial port is long past
<crest> often the chipset still includes the serial port
<crest> but it isn't exposed to the user
<tabemann> yeah
<tp> fortunately usb-3.3v dongles are a $0.90 commodity
<tp> so it's not an issue
<tabemann> cheap FTDI clones straight from china
<tabemann> cheap enough that if the FTDI firmware updates brick the cloned chipset, oh well
<tabemann> the problem is when real live products include those cheap FTDI clones, and they get bricked
<tabemann> and then people wonder why, inexplicably, the serial ports on their expensive equipment no longer work
dddddd has quit [Ping timeout: 256 seconds]
<tp> updates ???
<tabemann> yeah
<tp> who updates a usb-3.3v dongle ????
<tabemann> there was an FTDI driver update that was designed to brick any of the chinese FTDI clones
<crest> don't install the official driver and use a the one included in linux and *bsd?
<tabemann> yeah
<tabemann> the solution is to use linux or xbsd or to never windows update your machine ever
<tp> just use the device, forget about ever updating it
<tabemann> nah, it's the driver installed on your windows machine
<crest> tabemann: tp got the never update your machine part covered
<tabemann> not updating the device
<tp> CP2102 chipset
<tp> who needs fttdi ?
<tp> crest, hahah, FreeBSD makes updating easy providing you run a current release
<crest> just be careful going from 11.x to 12.x and follow the official steps
<crest> no just make installkernel installworld ; etcupdate ; etcupdate resolve
<crest> i managed to mess up (an recover) one system by skipping the correct steps and reboots
<tp> crest, I never update I always do a new install
<tp> then I just import my zfs array
<crest> my desktop/workstation still runs my second ever freebsd installation
<tabemann> I'm a debian user and I've gone years upon years without doing a fresh install
<tp> tabemann, we are sorry to hear that ;-)
<tabemann> lol
<tp> tabemann, will now be known as 'cruft-boi'
<crest> i moved this system from 32bit to 64bit, from ufs to zfs etc.
<tabemann> why install from fresh when one can do sudo apt update ; sudo apt upgrade
<crest> tabemann: because you want to end up in a well defined state
<crest> my desktop is the only system i refuse to wipe
<tabemann> I don't want to have to reinstall everything I've installed on here
<crest> tabemann: ansible?
<tp> tabemann, Linux users are born to suffer I guess
<tabemann> nah, there are linux users who will install everything from scratch too
<tabemann> I just don't like doing things this way
<tp> tabemann, who install from scratch ?
<tp> I dont
<tabemann> oh, and by the way, doing clone (from ihex.fs) to dump everything in the ram of my F407 board (which includes lots of empty filler space due to the limitations of flash erasure on it) is almost instantaneous
<tp> new install doesnt = from scratch
<tp> tabemann, with swdcom ?
<tabemann> yes
<tp> wow, I havent tried that yet
<tp> shame you cant capture it yet
<tabemann> whereas dumping it all with serial at 115200 baud takes about half a minute
<tp> yeah, it's slow
<crest> you can capture swdcom
<tp> hmm
<crest> echo dump | ./swd2 $addr | tee log.txt
<tp> swd2 address <ihex >log.txt ?
<crest> okay make that (echo dump ; sleep 1) |
<tp> crest, you have to start the ihex dump first
<tp> ahh thats 'dump' ?
<tp> tis I have to try!
<crest> the problem is that there is no nice way to wait
<crest> swd2 quits on end of file
<tp> why wait ?
<crest> because it stops reading the output as well
<crest> and you want to capture the output
<tp> oh <doh>
<tp> so just tee ?
<crest> also possible
<tp> swd2 address | tee log.txt
<crest> just tee and remove the execess around the ihex
<tp> i have to do that anyway, i have a script that does it all
<crest> also you could restore the serial console first
<tp> my dump has a start and end keyword
<crest> and patch your dump code to call swd-emit instead of emit
<crest> nothing (of value) is lost be deconnecting and reconnecting
<crest> swdcom stores the buffer in the target ram
<crest> that allows swd2 to terminate without losing that buffer
<tabemann> back
<tp> swdcom is vry cool, a magnificient concept
<tabemann> okay, it isn't instantaneous
<tp> hahah
<tabemann> it needs more than one second to read all the data
<tabemann> but it still is really fast
<tp> 10 hours ?
<tabemann> compared to serial
<tabemann> lol
<tp> al we need is error feedback from uploads
<tp> and we are there
<tp> at least as far as using screen goes
<crest> i my current state i would do more harm than good to the code
jsoft has joined #forth
<tp> no sleep ?
<crest> tp: exactly
<tp> it being 0630!
<crest> why don't you use sed -e
<tp> I'm a technician ?
<crest> ok
<tp> Im just a rough hack
<crest> but it does safe bandwidth
<tp> thats not a problem on this boz
<tp> box
<crest> on the uart
<tp> ?
<crest> not sending the comments saves time
<tp> i dont send comments
<tp> thats used on my pc where all my Forth source is written
<tp> zero comments leave the pc to the Forth target
<tabemann> okay, I should get to bed
<tabemann> g'night guys
<tabemann> and crest, thank you for swdcom
<tp> night tabemann
<tp> yes crest, thank you for swdcom
<crest> :-)
<tabemann> oh, and btw tp
<tabemann> I committed code for zeptoforth which fixes the control characters problem
<tp> tabemann, cool!
<tabemann> so if you hit up you'll just get garbage like [A
<crest> tabemann: how does zeptoforth compare to mecrisp? what made you start your own forth?
<tabemann> rather than having the cursor actually move up a line while corrupting the input buffer
<crest> did you write down a comparison somewhere?
<tabemann> crest: I've never really compared zeptoforth to mecrisp; I just wanted to write my own forth for an embedded platform, and Cortex-M4 MCUs seemed like a good target
<crest> ok
<tp> crest, tabemann is a Forth implementer, thats what they do
<crest> :-P
<tabemann> note that parts of zeptoforth, particularly the serial console and the flash controller code are heavily based off of mecrisp-stellaris
<tabemann> while the vast majority of zeptoforth is a completely new implementation, independent of mecrisp-stellaris
<tabemann> note that in ways mecrisp-stellaris is more mature than zeptoforth, particularly because it has RA which zeptoforth lacks
<tp> Zeptoforth does have a ton of extra facilities; kitchesink.fs, theanswertoeverything.fs
<tabemann> in other ways zeptoforth has advantages, like as long as one uses a "full" binary one gets interrupt-driven serial IO out of the box along with power management
<tabemann> it also has wordlists, as of version 0.6.0, integrated into the core of zeptoforth, whereas VOCs in mecrisp-stellaris are an experimental extra
<crest> adding powermangement wouldn't hard
<crest> but having it built in is nice
<tp> crest, wanna bet ?
<tabemann> crest: the key thing is that power management is integrated with multitasking
<crest> tp: not optimal powermanagement
<crest> but sleeping instead of polling
<crest> with wakeups by the usart interrupts
<tp> crest, dont coment on stm32 power management until you try and implement it
<tabemann> yep, zeptoforth has that
<crest> tp: i played with it
<crest> and it looked like it worked
<tabemann> note that zeptoforth only uses "sleep" mode, not "stop" mode or any of the other modes
<tp> crest, which level of power management did you use ?
<tp> there are three modes
<crest> just the idle until interrupt instruction
<crest> nothing deeper
<tp> sleep ?
<tp> there is no idle mode
<crest> WFI? WFE? something like that
<tabemann> you mean WFI with the default power management option
<tp> I've done a comprehensive study with power measurements
<tabemann> that's what I use as well
<tp> WFI is required to enter any of the THREE modes
<tp> or WFE
<crest> one step better than just polling the usart status register all the time
<tp> what happens after the WFI depends on the setup before WFI is called
<tp> crest, maybe, maybe not
<crest> exactly
<crest> that was before i had a stlink to even samlpe the program counter
<tp> crest at least the board you have ordered has all the latest power resources
<tabemann> the thing about sleep mode is that it doesn't save as much power, but it is quickest to get out of that state
<tp> the STm32F103 in the blue pill has only coarse power control
<crest> and i have no idea how the debugger interferes with sleeping
<tp> tabemann, is right
<tabemann> in the case of zeptoforth, the systick is constantly waking up the processor, so it is necessary to exist the power management mode - and return to it - as fast as possible
<tp> various sleep modes will result in a long wake up of the usart with missing characters unless allowed for
<tp> low power is a MASSIVE study on it's own
<tabemann> and also because if input is being continuously fed in, as tp says, it'll lose characters if it's not as fast as possible
<crest> tabemann: only without reliable flow control
<tp> I know a very smast and capable embedded programmer who spent 3 months getting the lowest power on a commercial product, he said it nearly drove him crazy
<crest> you could use a timer to poll the swd ring buffers
<crest> you could even increase sleep time after a period of inactivity
<crest> to keep uploads fast but otherwise poll at a human friendly rate
<tp> in the end his product used about 8 nA in sleep !
<crest> after a few minutes without transfers you could go into even deeper sleep
<tabemann> actually, with how I have it working right now, it's going to sleep and not being woken up, until a systick wakes up the processor
<tabemann> mind you systick is occurring at 1/10 ms intervals
<tp> whereas it needs input data to wake it
<tabemann> so it can transfer data in either direction as up to 255 bytes per 1/10th of a millisecond
<crest> with swdcom?
<tabemann> yes
<tabemann> it's a limitation imposed by the fact that I'm not having it busywait
<tabemann> but rather having it be woken up by systick
<tabemann> do stuff
<tabemann> then go back to sleep
<crest> that's 2.55MB/s
<tp> nevertheless Zeptoforth doesnt use much power, a great job by tabemann
<crest> (in theory)
<tabemann> okay, I should actually go to bed now
<tp> hehe
<tabemann> g'night guys for reals now
<tp> and crest1
<tp> and crest!
<crest> gn8 guys
<tabemann> yeah, you go to bed too, it's even later for you
<tp> night tabemann and crest
<tabemann> n8
<tp> it's 3pm here
gravicappa has joined #forth
<tp> see swd
<tp> 0000A00C: 603E str r6 [ r7 #0 ]
<tp> 0000A010: 0476 lsls r6 r6 #11
<tp> 0000A00A: 3F04 subs r7 #4
<tp> 0000A00E: 2680 movs r6 #80
<tp> 0000A012: 36EA adds r6 #EA
<tp> 0000A014: 0176 lsls r6 r6 #5
<tp> 0000A016: 3618 adds r6 #18
<tp> 0000A018: 4770 bx lr
<tp> Bytes: 16 ok.
<tp> lol, not much
proteus-guy has quit [Ping timeout: 256 seconds]
reepca has quit [Read error: Connection reset by peer]
reepca has joined #forth
dys has quit [Ping timeout: 256 seconds]
dys has joined #forth
andrei-n has joined #forth
guessgood has joined #forth
guessgood has quit [Quit: Connection closed]
andrei-n has quit [Ping timeout: 240 seconds]
andrei-n has joined #forth
mtsd has joined #forth
andrei-n has quit [Ping timeout: 256 seconds]
reepca has quit [Ping timeout: 246 seconds]
jedb_ has joined #forth
jedb has quit [Ping timeout: 256 seconds]
TCZ has joined #forth
scj has joined #forth
Zarutian_HTC has quit [Ping timeout: 256 seconds]
scj has quit [Remote host closed the connection]
jsoft has quit [Ping timeout: 246 seconds]
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #forth
TCZ has quit [Quit: Leaving]
andrei-n has joined #forth
mtsd has quit [Quit: Leaving]
Zarutian_HTC has joined #forth
iyzsong has joined #forth
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #forth
jedb_ has quit [Ping timeout: 256 seconds]
APic has quit [Ping timeout: 256 seconds]
APic has joined #forth
dddddd has joined #forth
jedb has joined #forth
Zarutian_HTC has quit [Ping timeout: 260 seconds]
crc_ has quit [Quit: ZNC 1.7.4 - https://znc.in]
crc_ has joined #forth
TCZ has joined #forth
TCZ has quit [Quit: Leaving]
andrei-n has quit [Quit: Leaving]
iyzsong has quit [Quit: ZNC 1.8.0 - https://znc.in]
proteus-guy has joined #forth
cmtptr_ has joined #forth
cmtptr has quit [Ping timeout: 265 seconds]
jedb has quit [Ping timeout: 256 seconds]
WickedShell has joined #forth
Zarutian_HTC has joined #forth
Zarutian_HTC has quit [Ping timeout: 256 seconds]
dys has quit [Ping timeout: 256 seconds]
xek has joined #forth
Zarutian_HTC has joined #forth
cmtptr_ is now known as cmtptr
xek has quit [Ping timeout: 260 seconds]
dave0 has joined #forth
gravicappa has quit [Ping timeout: 246 seconds]
TCZ has joined #forth
TCZ has quit [Quit: Leaving]
X-Scale` has joined #forth
X-Scale has quit [Ping timeout: 246 seconds]
X-Scale` is now known as X-Scale
<tp> crest, ping
<crest> pong
<crest> i cleaned up the code a little
<tp> hey I had a lot of fun playing with swdcom last night, it's very impressive! I was thinking could you save the #address in a register and get it that way ?
<tp> Mecrisp-Stellaris has a few unused registers
<crest> but that would take the register away from the user
<crest> i had a different idea
<tp> doesnt matter, there are a few spares and most users dont touch them
<crest> ich stlink is supposed to have its own serial number
<crest> and i just wanted to cache the address per serial number
<tp> i think I understand how your swdcom works now :)
<crest> do you want to test your understanding?
<crest> look at the latest version on github
<tp> it's quite superficial, but sure
<tp> ok will do
<crest> i cleaned it up a little a few minutes ago
<tp> whats the git update command ?
<crest> git pull
<tp> (I dont use git, dont like it)
<crest> i agree that git has an annoying and at times dangerous interface
<tp> I've ben spoilt by fossil
<crest> if only fossil had something like git add -p
<crest> but the largest problem with fossil is mindshare
<tp> aha a Makefile
<crest> oh and i make heavy use of git annex to keep my media archive synced
<tp> I'm not trying to convert anyone
<tp> i just noticed that my disco board SWD interface 'dual color led' cycles when swdcom is connected, it looks funky
X-Scale` has joined #forth
<tp> also happens when using swd to flash or with gdb etc
X-Scale has quit [Ping timeout: 264 seconds]
X-Scale` is now known as X-Scale
<tp> agree fossil mindshare is minimal probably always will be, same as freebsd
<tp> if i wanted a OS with the greatest mindshare Id still be using windows or Linux
<tp> so how do you fetch the $address in regard to a stlink serial number ?
<crest> you would have to set it once
<tp> before you can access the buffers you need to know the $address ?
<crest> your idea to put the base address into a register a good one
<crest> i just don't want to "steal" a precious register from the programmer
<tp> the problem with setting it is you need a serial connection to make it work
<tp> theyre NOT precious
<tp> this is Forth
<crest> i think i have a better idea
<tp> You can use r0, r1, r2 and r3 freely; you need to push/pop r4 and r5 before use, and you can use r6/r7 and r13/r14 as stacks.
<crest> i'll fill the ring buffers with some magic pattern and scan for it on connect
<tp> r 8 Unused, available for your special purposes. Keep in mind that on M0, only a few opcodes are available for them (MOV, ADD, CMP, as far as I know)
<tp> r 11 Unused, available for your special purposes.
<tp> r 10 Unused, available for your special purposes.
<tp> r 12 Unused, but saved automatically on interrupt entry.
<tp> r 9 Unused, available for your special purposes. You may get a error/warning ‘Use low registers’
<tp> r8 - r12 are not generally available under Mecrisp-Stellaris on a cortex-mo anyway
<tp> being restricted under thumb1
<tp> and anyway, once the address is fetched, a user can use that register as it's not needed ?
<crest> correct
<crest> unless i wanted to allow users to relocate the buffer at runtime *shudder*
<crest> it looks like the covid19 backlog has been cleared. my stm32l476 boards should arrive in a few hours
<tp> awesome
<tp> it's a great board, modern flash
<tp> tabemann loves his unit
<tp> wow, i haven't looked at swd2.c before, you have put a lot of work into that!
<tp> I can get a manual dictionary dump in intelhex now, works great, but can't automate it as you said, swdcom terminates too fast
<tp> screen runs to conclusion but mt batch file needed sleep before using the logfile, it's a pain
<tp> so id set the sleep for the longest expected time and just wait if it's shorter ...
<crest> i just added proper signal handling for SIGINT and SIGTERM
<tp> i just loaded up your latest on my test board, works great!
<tp> it's fast!