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/10/22 10:29:52 UTC

[GitHub] [mynewt-core] kasjer opened a new pull request, #2906: stm32/spi: Init Instance in hal_spi_init

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

   This fixes the problem firmware update on STM32 devices with external flash that is enabled
   in bootloader (most likely when second slot is in external flash as is configured for black_vet6,
   but could happen also when both slots are in normal flash and spiflash is enabled in bootloader
   for other reason).
   
   spi->handle.Instance initiated to constant value (register address) It was done in hal_spi_config() so value was set every time this function was called which is not the main reason it is moved now to hal_spi_init().
   
   Main reason is that in spiflash code call to hal_spi_disable() is made before first call to hal_spi_config() it can result in writes to addresses around 0 which most likely be internal flash address. It can result in exception if MPU is present and configured to block writes to this region. In other cases it can set error flag in flash register that is never cleared by ST HAL flash driver code HAL_FLASHEx_Erase() as is done in HAL_FLASHEx_Erase_IT(). This in turn prevents bootloader to swap images since during erase error is reported.
   Erase function from STM HAL (at least for STMF4/7/2) could be fixed to do what HAL_FLASHEx_Erase_IT does with error flags. But for now just setup correctly Instance.


-- 
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 #2906: stm32/spi: Init Instance in hal_spi_init

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


-- 
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 #2906: stm32/spi: Init Instance in hal_spi_init

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

   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/mcu/stm/stm32_common/src/hal_spi.c
   <details>
   
   ```diff
   @@ -437,27 +436,27 @@
            break;
    #endif
    #if SPI_1_ENABLED
   -        case 1:
   +    case 1:
            spi->handle.Instance = SPI2;
            break;
    #endif
    #if SPI_2_ENABLED
   -        case 2:
   +    case 2:
            spi->handle.Instance = SPI3;
            break;
    #endif
    #if SPI_3_ENABLED
   -        case 3:
   +    case 3:
            spi->handle.Instance = SPI4;
            break;
    #endif
    #if SPI_4_ENABLED
   -        case 4:
   +    case 4:
            spi->handle.Instance = SPI5;
            break;
    #endif
    #if SPI_5_ENABLED
   -        case 5:
   +    case 5:
            spi->handle.Instance = SPI6;
            break;
    #endif
   ```
   
   </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] apache-mynewt-bot commented on pull request #2906: stm32/spi: Init Instance in hal_spi_init

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

   
   <!-- 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