Add genericSTM32F103Cx board type with 128k flash

User avatar
RogerClark
Posts: 7443
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Add genericSTM32F103Cx board type with 128k flash

Post by RogerClark » Sun Jul 30, 2017 10:09 am

See https://github.com/rogerclarkmelbourne/ ... 2/pull/317

I'm not entirely sure why we need a board variant which is basically the F103CB just called F103Cx because the MCU's labelled as C8 seem to be CB's

Note. This PR also included an unrelated change to fix a typo in the F103CB RAM size. I've fixed this individually in a separate commit, as IMHO it should not have been part of this change, and was a definite bug

testato
Posts: 39
Joined: Sun Aug 14, 2016 7:44 am

Re: Add genericSTM32F103Cx board type with 128k flash

Post by testato » Sun Jul 30, 2017 11:17 am

The change is not only the name but the cpuflag
If you use the CB you will use the cpu_flag of the CB cpu

What is there under behind the different cpu_flag ?
Last edited by testato on Sun Jul 30, 2017 2:32 pm, edited 1 time in total.

victor_pv
Posts: 1740
Joined: Mon Apr 27, 2015 12:12 pm

Re: Add genericSTM32F103Cx board type with 128k flash

Post by victor_pv » Sun Jul 30, 2017 12:41 pm

I dont think that CPU flag does much of a difference, given that the C8 and CB are exactly the same except for the flash (same peripherals, same RAM, same addresses for everything). There are other MCUs that differe in the number of Timers, SPI ports, having I2S mode, but that's not the case between C8 and CB, they are idential other than flash size and MCU ID bits.


On top, I think is generally accepted that the C8 MCUs with 128KB are actually renames CB MCUs (CB silicon to all effects).

Given all that, I think it would be confusing to add another board to be basically the same as the CB board. People will wonder if selecting that option does something different than selecting the CB option (it does not).

Perhaps is a better option to rename the CB board option to add meaning that it can be used in C8 MCUs with 128KB of flash.

I tested in the past that several RC MCUs I got have the flash and RAM of RE mcus, so STM did the same with more MCUs than just the 128KB ones. I do not think it would be of any benefit to add a new variant just for that, since I can use the RE variant to use all that flash and RAM.

My 2 cents.

User avatar
Pito
Posts: 1627
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Add genericSTM32F103Cx board type with 128k flash

Post by Pito » Sun Jul 30, 2017 12:50 pm

Does the ST-Link upload method support a loading of >64kB code into such devices (devices with more flash as advertised)?
Pukao Hats Cleaning Services Ltd.

victor_pv
Posts: 1740
Joined: Mon Apr 27, 2015 12:12 pm

Re: Add genericSTM32F103Cx board type with 128k flash

Post by victor_pv » Sun Jul 30, 2017 1:27 pm

Pito wrote:
Sun Jul 30, 2017 12:50 pm
Does the ST-Link upload method support a loading of >64kB code into such devices (devices with more flash as advertised)?

Yes, in the ones that actually have that amount of flash, you can access it with STlink without any error. Stlink will show the 64KB size though, because the MCU ID is the correct one for a C8, but if you try to access flash beyond 64KB, for reading/writing, it works fine.
Most C8 have 128KB, but there is a few forum posts from people that got one with 64KB of flash. I do not know if there is any way to tell from the MCU markings, like week, year...

testato
Posts: 39
Joined: Sun Aug 14, 2016 7:44 am

Re: Add genericSTM32F103Cx board type with 128k flash

Post by testato » Sun Jul 30, 2017 2:28 pm

the serial bootloader in it's welcome message clearly tell if you have 128KiB of flash or not

Code: Select all

Device ID  : 0x0410 (Medium-density)
- RAM  : 20 KiB (512b reserved by bootloader)
- Flash  : 128 KiB (sector size: 4x1024)
- Option RAM : 16 b
- System RAM : 2 KiB
It was interesting to read the bootloader serial message on the C8 version that claim to have only 64KiB.

But so:
- Device ID is different: 0x0410
- cpu_flag is different: -DMCU_STM32F103C8
- the name of the board that I used is clear: STM32F103C8 Experimental (20k RAM. 128k Flash)

I tell: "Why Not ?"

Blue PIll is the most famous end the entry point for the maker on the low cost 32bit, I think it is a useful add for all this person. And also if there is no technical difference on the different cpu_flag, etc, under the cover, it will help to adopt this Core and ST cpu

victor_pv
Posts: 1740
Joined: Mon Apr 27, 2015 12:12 pm

Re: Add genericSTM32F103Cx board type with 128k flash

Post by victor_pv » Sun Jul 30, 2017 2:41 pm

testato wrote:
Sun Jul 30, 2017 2:28 pm
the serial bootloader in it's welcome message clearly tell if you have 128KiB of flash or not

Code: Select all

Device ID  : 0x0410 (Medium-density)
- RAM  : 20 KiB (512b reserved by bootloader)
- Flash  : 128 KiB (sector size: 4x1024)
- Option RAM : 16 b
- System RAM : 2 KiB
It was interesting to read the bootloader serial message on the C8 version that claim to have only 64KiB.

But so:
- Device ID is different: 0x0410
- cpu_flag is different: -DMCU_STM32F103C8
- the name of the board that I used is clear: STM32F103C8 Experimental (20k RAM. 128k Flash)

I tell: "Why Not ?"

Blue PIll is the most famous end the entry point for the maker on the low cost 32bit, I think it is a useful add for all this person. And also if there is no technical difference on the different cpu_flag, etc, under the cover, it will help to adopt this Core and ST cpu
Testato, I think the question should not be why not, but "why?"
Does this add something that currently can't be done, or makes it easier to do or more efficient? I fail to see the benefit, and in the other hand it adds a bunch of lines that need to be maintained. Whenever a new upload method is added, or flags changed, etc, there will be a whole separate entry to maintain.

I am not opposed to rename the CB entry to something else indicative it can be used in the C8 with 128KB, but I do not see what is the benefit of adding a whole new entry.
Could you please help me understand what's the advantage of having a new board VS using the CB option (with it's current name or a new one)?

User avatar
Rick Kimball
Posts: 1056
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Add genericSTM32F103Cx board type with 128k flash

Post by Rick Kimball » Sun Jul 30, 2017 3:55 pm

testato wrote:
Sun Jul 30, 2017 2:28 pm
the serial bootloader in it's welcome message clearly tell if you have 128KiB of flash or not

Code: Select all

Device ID  : 0x0410 (Medium-density)
- RAM  : 20 KiB (512b reserved by bootloader)
- Flash  : 128 KiB (sector size: 4x1024)
- Option RAM : 16 b
- System RAM : 2 KiB
It shows 128 KiB because the stm32flash utility uses a hardcoded value from an internal data structure based on the device id:
https://github.com/rogerclarkmelbourne/ ... able.c#L36
However that approach isn't really right.

I have a blue pill that show 128 k with the stm32flash utility. However, the official windows ST-LInk utility shows it having 64 k.
stlinkutil.png
stlinkutil.png (51 KiB) Viewed 257 times
If I use openocd and gdb to examine the actual value of the chip from the Flash Size register (0x1FFF FF7E0) it shows 64 k:
(gdb) x/hd (0x1FFFF7E0)
0x1ffff7e0: 64
So my chip reports 64k of flash. stm32flash reports the wrong size, the windows stlink.exe reports the correct size. However, in spite of all that, I can use all 128 k bytes of flash on that chip that supposedly don't exist.

I too wanted to have custom board entries that probably would just be noise to everyone else using stm32duino. I put together a simple makefile that appends my preferences to the end of the boards.txt. Maybe this is a solution for you:

https://gist.github.com/RickKimball/71a ... 2ecf4e095/
viewtopic.php?t=1741
-rick

User avatar
RogerClark
Posts: 7443
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Add genericSTM32F103Cx board type with 128k flash

Post by RogerClark » Sun Jul 30, 2017 9:33 pm

I'm not sure the STLink upload setting will allow you to upload 128k to a 64k device, as we use ST's own Exe.

I did try using Texane STLink on Windows, like we have to on Mac and Linux , but Texane seems to have problems with some STLink hardware, so for greater compibility I went back to STs own tools.

User avatar
mrburnette
Posts: 1877
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Add genericSTM32F103Cx board type with 128k flash

Post by mrburnette » Mon Jul 31, 2017 2:38 am

Respectfully to all:

I think too much f'n time is being wasted on menu this 'n that. If something is wrong and confusing, then it should be corrected at some point-in-time; but just stick an addendum on github in the WiKi until Roger gets around to it. But IMO, 128 vs 64 is just splitting hairs and we stick that info in the WiKi and go on about our lives.

Ray

Post Reply