Skip to content

stm32_common/flashpage: cleanup#11715

Merged
aabadie merged 4 commits intoRIOT-OS:masterfrom
fjmolinas:pr_stm32_flashpage_cleanup
Jun 20, 2019
Merged

stm32_common/flashpage: cleanup#11715
aabadie merged 4 commits intoRIOT-OS:masterfrom
fjmolinas:pr_stm32_flashpage_cleanup

Conversation

@fjmolinas
Copy link
Contributor

@fjmolinas fjmolinas commented Jun 18, 2019

Contribution description

This PR cleans up flashpage.c. Following discussion in #11681 it changes defines to makes specific behaviors explicit. Some unused functions and definitions where removed, specifically for stm32l1/0 and stm32l4.

NOTE: to verify the stm32l1/l0 change you can refer to the RM p71 for L1 and p89 for L0x3 and p81 for L0x1.

Testing procedure

Run make -C tests/periph_flashpage/ BOARD=nucleo-l476rg flash test for an stm32l1, stm32l0 and stm32l4 , stm32f0 and stm32f1 board.

The test should still pass in all cases.

Tested on: nucleo-l152re, b-l072rz-lrwan1, nucleo--l476rg, nucleo-f072rb, iotlab-m3.

Issues/PRs references

@fjmolinas fjmolinas added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Jun 18, 2019
@fjmolinas fjmolinas requested a review from aabadie June 18, 2019 09:37
@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: cpu Area: CPU/MCU ports labels Jun 19, 2019
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

I have some cosmetic comments, mainly on commit content which are for 2 of them unrelated to the commit message.

uint16_t *dst = page_addr;

#endif
#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change should be in it's own commit and not in b72a6ed where it's unrelated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why? Only STM32F0 STM32F1 need to initialize HSI clock (at least for the implemented boards). My goal was to separate it from the default case which only said /* Default is to support half-word sizes */, But I guess you are right, the commit message is not explicit enough. Would you be Ok with just re-wording?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, this changes the initial behaviour as you say, so it needs to be in its own commit.

defined(CPU_FAM_STM32L4)
CNTRL_REG &= ~(FLASH_CR_PG);
DEBUG("[flashpage_raw] write: done writing data\n");
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

The DEBUG message above is now only displayed with F0/F1/L4 but not for L0/L1. It should be put after.
I would also not put this change in 5e0c867 because it seems unrelated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right about the DEBUG message. But it is related since I'm removing the definition of FLASH_CR_PG Therefore I need to excluded it from compilation and that is the reason for the #ifdefined. Should I split guarding and removing FLASH_CR_PG into two commits?

Copy link
Contributor

@aabadie aabadie Jun 20, 2019

Choose a reason for hiding this comment

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

I see, let's keep the changes in the same commit then. You still have to fix the commit message: it's full of typos :)

Copy link
Contributor

Choose a reason for hiding this comment

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

The DEBUG line must still move out of the define (preferably after).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

damn, I was concentrating on the typos sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I think now it should be ok .. sorry for missing this.

@aabadie
Copy link
Contributor

aabadie commented Jun 20, 2019

There is also a typo in 9416ca8 message: repited => repeated

@aabadie
Copy link
Contributor

aabadie commented Jun 20, 2019

I tested this on nucleo-l432kc, nucleo-l073rz, nucleo-l433rc and iotlab-m3. It worked.

Just rework a bit the commits and we are good to go.

- Before, HSI was enabled as the default case when it is only
  used for stm32f0 and stm32f1. It is now implemented explicitly
  for those platforms, and only those.
@fjmolinas fjmolinas force-pushed the pr_stm32_flashpage_cleanup branch 2 times, most recently from 0f98ad9 to 72ffaf5 Compare June 20, 2019 07:34
@fjmolinas
Copy link
Contributor Author

@aabadie Changes addressed, I split the commit you where addressing into two. One separating the hsi handling case from the default case. And the second one making the remaining implicit defines explicit, what do you think?

- Since writes are performed per word no actions need
  to be performed for flash access, and the FPRG doesn't
  need to be cleared.
@fjmolinas fjmolinas force-pushed the pr_stm32_flashpage_cleanup branch from 72ffaf5 to 46b9013 Compare June 20, 2019 07:43
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

All good now, ACK

@aabadie aabadie merged commit a671c6c into RIOT-OS:master Jun 20, 2019
@fjmolinas fjmolinas deleted the pr_stm32_flashpage_cleanup branch August 7, 2019 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants