Skip to content

Commit

Permalink
Added the implementation of embedded flash for WB32 MCU.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joy committed Jul 7, 2022
1 parent 022d0ec commit 5279504
Show file tree
Hide file tree
Showing 10 changed files with 1,333 additions and 5 deletions.
23 changes: 21 additions & 2 deletions os/common/ext/CMSIS/WB32/WB32F3G71xx/wb32f3g71xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,24 @@ typedef struct
#warning Not supported compiler type
#endif



static const uint32_t flash_size_code_map[16] = {
0x80000, /* 512kB */
0x8000, /* 32kB */
0x60000, /* 384kB */
0x40000, /* 256kB */
0x20000, /* 128kB */
0x8000, /* 32kB */
0x18000, /* 96kB */
0x10000, /* 64kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x30000, /* 192kB */
};

/* ================================================================================ */
/* ================ Peripheral memory map ================ */
Expand All @@ -958,6 +974,9 @@ typedef struct
#define SRAM_BB_BASE ((uint32_t)0x22000000UL) /*!< SRAM base address in the bit-band region */
#define PERIPH_BB_BASE ((uint32_t)0x42000000UL) /*!< Peripheral base address in the bit-band region */

#define SYS_MEMSE ((uint32_t)0x40016404UL)
#define FLASH_SIZE flash_size_code_map[(*((volatile uint32_t *)(SYS_MEMSE))) & 0xFU]

#define APB1PERIPH_BASE PERIPH_BASE
#define APB2PERIPH_BASE (PERIPH_BASE + 0x08000)
#define AHBPERIPH_BASE (PERIPH_BASE + 0x10000)
Expand Down
21 changes: 21 additions & 0 deletions os/common/ext/CMSIS/WB32/WB32FQ95xx/wb32fq95xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,24 @@ typedef struct
#warning Not supported compiler type
#endif

static const uint32_t flash_size_code_map[16] = {
0x80000, /* 512kB */
0x8000, /* 32kB */
0x60000, /* 384kB */
0x40000, /* 256kB */
0x20000, /* 128kB */
0x8000, /* 32kB */
0x18000, /* 96kB */
0x10000, /* 64kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x8000, /* 32kB */
0x30000, /* 192kB */
};

/* ================================================================================ */
/* ================ Peripheral memory map ================ */
Expand All @@ -901,6 +919,9 @@ typedef struct
#define SRAM_BB_BASE ((uint32_t)0x22000000UL) /*!< SRAM base address in the bit-band region */
#define PERIPH_BB_BASE ((uint32_t)0x42000000UL) /*!< Peripheral base address in the bit-band region */

#define SYS_MEMSE ((uint32_t)0x40016404UL)
#define FLASH_SIZE flash_size_code_map[(*((volatile uint32_t *)(SYS_MEMSE))) & 0xFU]

#define APB1PERIPH_BASE PERIPH_BASE
#define APB2PERIPH_BASE (PERIPH_BASE + 0x08000)
#define AHBPERIPH_BASE (PERIPH_BASE + 0x10000)
Expand Down
Loading

0 comments on commit 5279504

Please sign in to comment.