You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/07/27 13:29:49 UTC

[GitHub] utzig commented on a change in pull request #1297: Fix some issues with the L1/L0 flash driver

utzig commented on a change in pull request #1297: Fix some issues with the L1/L0 flash driver
URL: https://github.com/apache/mynewt-core/pull/1297#discussion_r205772470
 
 

 ##########
 File path: hw/mcu/stm/stm32l1xx/src/hal_flash.c
 ##########
 @@ -65,31 +65,44 @@ static int
 stm32l1_flash_write(const struct hal_flash *dev, uint32_t address,
         const void *src, uint32_t num_bytes)
 {
-    const uint32_t *sptr;
+    uint32_t val;
     uint32_t i;
     int rc;
+    uint8_t align;
     uint32_t num_words;
 
     if (!num_bytes) {
         return -1;
     }
 
+    align = dev->hf_align;
+    num_words = ((num_bytes - 1) / dev->hf_align) + 1;
 
 Review comment:
   Yup, agreed but `udiv` is not thaaaat bad. I guess it will be worse on L0 which is Cortex-M0 and will need emulation. Btw, I took a look at the generated listing and there are only 3 divisions, this one + two in the clock initialization code inside the HAL!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services