cancel
Showing results for 
Search instead for 
Did you mean: 

stm32h7b0 has UNALIGNED hardfault problem when using lvgl9.1

zenghc
Visitor

Use sthm32h7b0 to push 800*480 TFT screen, using internal ram,using RGB565 color space. Run the test function lv_demo_widgets(), it can work normally under lvgl8.2. fter lvgl was upgraded from version 8.2 to version 9.1, after modifying the corresponding driver file, run the lv_theme_default_init function under the lv_demo_widgets function, and hardfault occurs. 

```
msh />psr: 0x01000000
r00: 0x0000000f
r01: 0x08084d7f
r02: 0x00000000
r03: 0x08084d70
r04: 0x240c21a4
r05: 0x240c21a0
r06: 0x240c219c
r07: 0xdeadbeef
r08: 0xdeadbeef
r09: 0xdeadbeef
r10: 0xdeadbeef
r11: 0xdeadbeef
r12: 0x00000000
 lr: 0x08029019
 pc: 0x08043636
hard fault on thread: LVGL
rt_thread_ thread   pri  status      sp     stack size max used left tick  error
---------- -------- ---  ------- ---------- ----------  ------  ---------- ---
0x240cc338 wav_p     15  suspend 0x000000c4 0x00000800    09%   0x0000000a EINTRPT
0x240cba94 k20s imp  16  suspend 0x000000e0 0x00000800    10%   0x0000000a EINTRPT
0x240cb5f0 k20s tx   15  suspend 0x000000a4 0x00000400    16%   0x0000000a EINTRPT
0x240cb14c k20s rx   15  suspend 0x000000b8 0x00000400    17%   0x0000000a EINTRPT
0x240ca4ec k20s imp  16  suspend 0x000000e0 0x00000800    10%   0x0000000a EINTRPT
0x240ca048 k20s tx   15  suspend 0x000000a4 0x00000400    16%   0x0000000a EINTRPT
0x240c9ba4 k20s rx   15  suspend 0x000000b8 0x00000400    17%   0x0000000a EINTRPT
0x240c7744 LVGL      25  running 0x00000048 0x00002000    01%   0x0000000a OK     
0x240c658c tshell    20  suspend 0x000000b8 0x00001000    04%   0x0000000a EINTRPT
0x240bff28 LVGL      25  ready   0x00000048 0x00002000    00%   0x0000000a OK     
0x240c3794 audio     14  suspend 0x000000a8 0x00000400    16%   0x00000001 EINTRPT
0x240024b0 usbd       8  suspend 0x000000c0 0x00001000    04%   0x00000014 EINTRPT
0x240037ac tidle0    31  ready   0x0000004c 0x00000100    29%   0x0000000e OK     
0x240c2470 main      10  suspend 0x00000124 0x00000800    41%   0x00000006 EINTRPT
usage fault:
SCB_CFSR_UFSR:0x100 UNALIGNED
```
Specifically locate the lv_palette_main function, and a non-alignment error occurs when returning.The location where the hardfault occurs is as follows:
 
1.jpg
 
```
typedef struct {
    uint8_t blue;
    uint8_t green;
    uint8_t red;
} lv_color_t;
```
lv_color_t is changed to 3 bytes. return colors[p]; When the statement runs, a hardfault occurs when half-word is loaded from address 0x8084d7F to register R2.
The value of SCB->CCR is 0x70200
 
```
  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  MPU_InitStruct.BaseAddress = FLASH_BANK1_BASE;
  MPU_InitStruct.Size = MPU_REGION_SIZE_1MB;
  // MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  MPU_InitStruct.AccessPermission = MPU_REGION_PRIV_RW_URO;
  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  MPU_InitStruct.Number = MPU_REGION_NUMBER3;
  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
  MPU_InitStruct.SubRegionDisable = 0x00;
  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
```

I would like to ask everyone, can stm32h7 not access the internal Flash in an unaligned manner? Is there any way to solve this problem?
0 REPLIES 0