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 2022/06/15 20:10:34 UTC

[GitHub] [mynewt-core] t3zeng opened a new pull request, #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

t3zeng opened a new pull request, #2851:
URL: https://github.com/apache/mynewt-core/pull/2851

   Ambiq's internal flash writing functionality does not allow for direct flash to flash memory transfers. This change handles situations like that by transferring to an intermediary ram buffer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851#issuecomment-1162157516

   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-core] kasjer commented on a diff in pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

Posted by GitBox <gi...@apache.org>.
kasjer commented on code in PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851#discussion_r902209722


##########
hw/mcu/ambiq/apollo3/src/hal_flash.c:
##########
@@ -168,6 +168,32 @@ apollo3_flash_write(const struct hal_flash *dev, uint32_t address,
     return rc;
 }
 
+static int
+apollo3_flash_write(const struct hal_flash *dev, uint32_t address,
+    const void *src, uint32_t num_bytes)
+{
+    int rc = 0;
+    uint32_t offset = 0;
+    uint32_t chunk_len;
+    uint8_t ram_buf[MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE)];

Review Comment:
   FLASH_INTERMEDIARY_BUF_SIZE is not in any syscfg.yml yet



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-core] t3zeng commented on pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

Posted by GitBox <gi...@apache.org>.
t3zeng commented on PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851#issuecomment-1156884661

   @kasjer @sjanc 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-core] t3zeng commented on a diff in pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

Posted by GitBox <gi...@apache.org>.
t3zeng commented on code in PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851#discussion_r903720138


##########
hw/mcu/ambiq/apollo3/src/hal_flash.c:
##########
@@ -168,6 +168,32 @@ apollo3_flash_write(const struct hal_flash *dev, uint32_t address,
     return rc;
 }
 
+static int
+apollo3_flash_write(const struct hal_flash *dev, uint32_t address,
+    const void *src, uint32_t num_bytes)
+{
+    int rc = 0;
+    uint32_t offset = 0;
+    uint32_t chunk_len;
+    uint8_t ram_buf[MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE)];

Review Comment:
   Added the definition to the mcu syscfg



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851#issuecomment-1156886227

   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/mcu/ambiq/apollo3/src/hal_flash.c
   <details>
   
   ```diff
   @@ -93,7 +93,7 @@
    
    static int
    apollo3_flash_write_default(const struct hal_flash *dev, uint32_t address,
   -    const void *src, uint32_t num_bytes) 
   +                            const void *src, uint32_t num_bytes)
    {
        const uint8_t *u8p;
        int lead_size;
   @@ -170,7 +170,7 @@
    
    static int
    apollo3_flash_write(const struct hal_flash *dev, uint32_t address,
   -    const void *src, uint32_t num_bytes)
   +                    const void *src, uint32_t num_bytes)
    {
        int rc = 0;
        uint32_t offset = 0;
   @@ -178,11 +178,12 @@
        uint8_t ram_buf[MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE)];
    
        /* Handle in the default manner if src data is already in ram */
   -    if((uint32_t)src > apollo3_flash_dev.hf_size - apollo3_flash_dev.hf_base_addr) {
   +    if ((uint32_t)src > apollo3_flash_dev.hf_size - apollo3_flash_dev.hf_base_addr) {
            rc = apollo3_flash_write_default(dev, address, src, num_bytes);
        } else {
   -        while(num_bytes) {
   -            chunk_len = num_bytes > MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) ? MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) : num_bytes;
   +        while (num_bytes) {
   +            chunk_len = num_bytes >
   +                        MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) ? MYNEWT_VAL(FLASH_INTERMEDIARY_BUF_SIZE) : num_bytes;
                memcpy(ram_buf, src+offset, chunk_len);
                rc = apollo3_flash_write_default(dev, address+offset, ram_buf, chunk_len);
    
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-core] kasjer merged pull request #2851: Ambiq Apollo3: Utilize ram buffer to handle flash to flash memory writes

Posted by GitBox <gi...@apache.org>.
kasjer merged PR #2851:
URL: https://github.com/apache/mynewt-core/pull/2851


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org