Doug,
Are you done with firmware? Got it all working? You still need to prune it to about 40K, maybe 50K-ish.
I’ve posted earlier that my x2 JL1 purchased at about same time in July, have different flash size, one is 64K and another is 128K. This is long known in Blue Pill world, that some 64K spec parts are actually 128K. This mean that target flash size must be 64K.
I perceive firmware vs. de-scrambling and using factory boot loader as two different efforts.
For Jack:
this is exactly what Doug now is talking about.
I think better code and firmware form Doug is just a matter of time.
De-scrambling is a bit of unknown. It can be super simple, or can be impossible. All depends. It appeared to me as simple but so far I have no idea how to scramble/descramble it.
Factory boot loader, as long as it is not erased or overwritten by STLink - will persist. I have tested it, flash JL3, then whatever else, then back and forth with various bin files - factory boot loader is safe. Feel free to boot into boot loader with button and flash whatever.
STLink however can easily overwrite it. Flashing with standard offset (beginning of the flash) will erase factory boot loader.
Without STLink or other special tool, most people using USB only, will have to live with factory boot loader. So, to use it, we should scramble BIN the same way. At this time the only thing loadable with factory boot loader is JL3 firmware. the good news is that apparently it is not possible to brick it f flashed only through USB (tested on board with 128K, I hope the same is true for 64K board).
Offset for factory firmware is easy to figure out. I’ve learned that flash can only be loaded in 1K chunks. Most boot loaders are 1-4 K. Worst case flash size minus firmware 64-40=24K (24 start addresses), left for boot loader. This is checkable manually, no special tools needed. Most likely will be some offset in full 1K iterations but no more that 8K. (I vaguely recall something that offset is full 1k plus 4 bytes, This info is mostly for Doug, please read about using bootloader+app code and offsets, I believe it is nK+4 or somersetting like that).
Clarification about boot and strapping boot pins:
-
STLink can flash the chip no matter what boot pins configuration is.
-
Both boot pins low => start form standard flash offset.
-
Boot0 high=> start form system memory, this is where factory (ST, not the JL1) boot code is. This is to flash though serial or other interfaces. I have to note that I have 5 year old Blue Pill that can be flashed over serial with Cube Prog as prescribed. JL1 board and latest lot of Blue Pills does not respond to serial connection by Cube. ST stated that they can program system memory to order, but user cannot change anything in system memory. I can speculate that these F103 have custom blanks in the system memory. Maybe somebody get better luck with ST factory boot loader. It is not difficult to jump Boot0 pin on JL1 board. It just appeared that it may or may not be the the option.
-
Boot1 will make chip to boot from specific offset in RAM. This is very specific use case and probably not for us.
-
It is not difficult to use command line utility and automate it with script. No need to be programmer, it can be made very simple. However still need 4-pin header and the dongle and driver for dongle installed (which did not install automatically on two ob my windows 10 PCs).
I’ve already posted samples form scrambled and unscrambled BINs. Collective help here can go long way.
Doug, I have two boards, one without boot loader, flashed with my own firmware. The other still have factory boot loader. I can test whatever you have.