Skip to content

boards: Split off 128KiB version of bl*pill #12169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 29, 2019
Merged

Conversation

maribu
Copy link
Member

@maribu maribu commented Sep 4, 2019

Contribution description

  • Created new bluepill-128kib as 128KiB version of the bluepill
  • Created new blackpill-128kib as 128KiB version of the blackpill
  • Updated openocd.cfg to allow flashing 128KiB of ROM

Testing procedure

Run and flash one app with ROM <= 64 KiB and one with with 64 KiB < ROM <= 128KiB.

On the bluepill and blackpill the first should flash and run, but the second should neither flash nor run. (You can build with make CPU_MODULE=stm32f103cb BOARD=bluepill to manually allow compiling with up to 128KiB ROM, but flashing should not work.)

On the bluepill-128kib and on the blackpill-128kib, both apps should compile and flash.

Notes:

  1. You will need the development version of OpenOCD for the flashing >64KiB ROM to succeed with bluepill-128kib or blackpill-128kib
  2. You don't need both boards, as they are basically identical (except for the LED pin and the form factor / pin mapping)

Issues/PRs references

If merged, #10902 is no longer needed, and thus closes #10902 ;)

@maribu
Copy link
Member Author

maribu commented Sep 4, 2019

@cladmi: I implemented the split of boards as suggested in the email list

@maribu maribu added Area: boards Area: Board ports Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Sep 4, 2019
@maribu maribu requested a review from jia200x September 4, 2019 13:19
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 5, 2019
@benpicco
Copy link
Contributor

benpicco commented Sep 9, 2019

Murdock thinks you should update some BOARD_INSUFFICIENT_MEMORY lists.
Looks pretty clean otherwise.

@cladmi
Copy link
Contributor

cladmi commented Sep 9, 2019

@maribu Thank you, I will look at it :)

@MrKevinWeiss you are a big user of the bluepill I think you may be interested to check

@cladmi
Copy link
Contributor

cladmi commented Sep 9, 2019

From a first quick look, I think the symlinks could be removed.
It is not a pattern we use that much in RIOT.

The easy ones are:

  • INCLUDES += -I$(RIOTBOARD)/bluepill/include for the headers
  • export OPENOCD_CONFIG = $(RIOTBOARD)/common/stm32f103c8/dist/openocd.cfg

For board.c, I can think of another hack to still use the bluepill board.
I did one in #12183 for the tests/external_board_native/external_boards/native/Makefile file.
Defining the bluepill-128k/Makefile that it is defining the boards_bluepill_128k module and set DIRS to go in the bluepill.

@MrKevinWeiss
Copy link
Contributor

@MrKevinWeiss you are a big user of the bluepill I think you may be interested to check

Slander and lies!!! 😆

I use bluepills for PHiLIP but not in RIOT. I do, however, have them and would be happy to help test and give an opinion.

@maribu maribu force-pushed the blxxxpill branch 2 times, most recently from 8583576 to 0ab4718 Compare September 10, 2019 09:23
@maribu
Copy link
Member Author

maribu commented Sep 10, 2019

@cladmi: I rewrote the whole thing and moved more code to the common module, which I renamed to boards/common/blxxxpill to account for being bluepill/blackpill specific. That way no symlinks or Makefiles hacks should be required. I updated the Makefile.include as you suggested to point to the shared openocd.cfg instead of using a symlink.

@MrKevinWeiss
Copy link
Contributor

Overall I like the idea. I don't think I have a 128KB bluepill but I can look around.

@MrKevinWeiss MrKevinWeiss added the Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines label Sep 11, 2019
@maribu
Copy link
Member Author

maribu commented Sep 11, 2019

I don't think I have a 128KB bluepill but I can look around.

All but the BluePill I gave you in Helsinki have 128 KiB ;-) They just claim to only have 64 KiB ;-)

With the development version of OpenOCD you'll be able to flash them with firmwares up to 128KiB out of the box. (Hopefully they do a release soon...)

@MrKevinWeiss
Copy link
Contributor

Ahh I thought that was the 32KB one. Perfect! such beautiful LEDs 😆

@cladmi
Copy link
Contributor

cladmi commented Sep 11, 2019

I take a look at the updated version today.

@MrKevinWeiss MrKevinWeiss added the Reviewed: 3-testing The PR was tested according to the maintainer guidelines label Sep 11, 2019
@MrKevinWeiss
Copy link
Contributor

Tested on the bluepills! I will wait to see if @cladmi has any additional comments on the code design.

@maribu
Copy link
Member Author

maribu commented Sep 11, 2019

Ahh I thought that was the 32KB one. Perfect! such beautiful LEDs 😆

Like the regular bluepills, it only claims to have half of the flash it is actually equipped with. So regular BluePills come with 128KiB, but report 64KiB to the programmer. The beautiful LED BluePill comes with 64 KiB flash, but reports only 32 KiB to the programmer.

@cladmi
Copy link
Contributor

cladmi commented Sep 11, 2019

This indeed solves the issue I raised on the mailing list with the special CPU_MODEL handling for #11477
I will do a PR that moves the CPU/CPU_MODEL after this one.

The refactoring with the board_common.h like this removed a lot of the previous duplication.

If I understand correctly, the blackpill is the same as the bluepill but with only a different LED0 gpio. Is that correct?

If you want to make it a bit more clear and remove duplication of the value in the blackpill* boards, you could define both values in board_common.h and in the blackpill headers say #define BLACKPILL_LED_MAPPING 1 or something. It would give only one definition and also document what are the default values.
But that is optimization and is not required in this PR.

Building example/default with all 4 boards in this PR give the same size as bluepill and blackpill in master as expected (considering the difference is only a gpio mapping).
The 128kib versions can link examples/gnrc_networking when the bluepill could not.

The handling for openocd with duplication is currently the normal way of doing it in RIOT.
There could be a common file if we were using --search to give the config directory instead of an absolute path to the file as we do now, but it is not the case, so good to duplicate.

The documentation moved to common/blxxxpill now contains information for both boards and has been updated to remove the FLASH_HACK.
The documentation for using the st-flash has been removed, but it is not needed anymore as openocd is now used for flashing the 128KiB directly.

However, I am not sure the common naming works, bluepill does not have the same number of letters as blxxxpill :p (just kidding of course)

@cladmi
Copy link
Contributor

cladmi commented Sep 11, 2019

Some optional personal preference, I would prefer to default definition with OPENOCD_CONFIG ?= for all the 4 values and include $(RIOTBOARD)/common/blxxxpill/Makefile.include at the end of the file.

It is a minor thing, but reflects a bit more how "common" boards are mainly currently implemented as a list of directories that are evaluated one after the other. And the "common" only sets if it was not overwritten by a main board.

This is nitpicking though, and would currently not change anything.
Ignore if you want :)

@maribu maribu removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 11, 2019
@fjmolinas
Copy link
Contributor

This is looking good, as far as I can tell @cladmi comments where addressed and @MrKevinWeiss tested this, any reasons to keep staling?

@maribu
Copy link
Member Author

maribu commented Sep 27, 2019

OK. Then squash, rebase, and update board insufficient memory?

@maribu
Copy link
Member Author

maribu commented Sep 27, 2019

(Updating the board insufficient memory lists will result in merge conflicts with a chance of 99%, as the makefiles are touched often to update just that list)

@benpicco
Copy link
Contributor

I think it would be a good idea to add the RAM and ROM size to Makefile.features and then just have the applications say how much they need instead of maintaining those lists.

@maribu
Copy link
Member Author

maribu commented Sep 27, 2019

@benpicco: I'm all in for reducing maintenance effort here. There is already an issue discussing ways to get rid of these pain-in-the-ass lists, but with no conclusion yet.

The problem with with the application-wise RAM/ROM requirements is, that these not only greatly depend on the architecture (e.g. in AVR all const arrays have to be kept in RAM, as it is a Harvard architecture) and even on the board (e.g. number of SPI config structs, board init code, etc.). I think that this might require so fine-grained control, that this might end up being similar effort.

@benpicco
Copy link
Contributor

Well then, just go ahead and squash (and update the insufficient memory lists while doing so).
Then we can swiftly merge this before any new conflicts creep in 😉

@maribu
Copy link
Member Author

maribu commented Sep 29, 2019

rebased

- Created new `bluepill-128kib` as 128KiB version of the `bluepill`
- Created new `blackpill-128kib` as 128KiB version of the `blackpill`
- Updated `openocd.cfg` to allow flashing 128KiB of ROM
@maribu
Copy link
Member Author

maribu commented Sep 29, 2019

squashed

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 29, 2019
Added new boards bluepill-128kib and blackpill-128kib where needed.
Linking works for both blackpill and bluepill
Added new blackpill-128kib and bluepill-128kib to BOARD_INSUFFICIENT_MEMORY
and BOARD_WHITELIST where needed.
@benpicco
Copy link
Contributor

I just tested this with a blackpill-128kib board and it's working fine.

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Murdock is happy and this makes using the 128k versions of those boards much more convenient!

@aabadie
Copy link
Contributor

aabadie commented Sep 29, 2019

Let's go with this one. I'll open just after the change about the definition of CPU/CPU_MODEL in Makefile.features (was waiting for this).

@aabadie aabadie merged commit c72f286 into RIOT-OS:master Sep 29, 2019
@maribu maribu deleted the blxxxpill branch September 29, 2019 19:07
@maribu
Copy link
Member Author

maribu commented Sep 29, 2019

Thanks everyone for the review and help!

@kb2ma kb2ma added this to the Release 2019.10 milestone Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants