stm32: desig: refactor to allow targets to have different addresses
In this commit, support for the different base addresses for different F7 parts is added, but the mechanism is now in place for L1 and others. Reviewed-by: Karl Palsson <karlp@tweak.net.au> (whitespace fixed, commit msg reworded)
This commit is contained in:
committed by
Karl Palsson
parent
f1b4a4dfff
commit
97688b913e
@@ -38,7 +38,7 @@ OBJS += adc.o adc_common_v1.o
|
||||
OBJS += can.o
|
||||
OBJS += crc_common_all.o
|
||||
OBJS += dac_common_all.o
|
||||
OBJS += desig.o
|
||||
OBJS += desig_common_all.o desig_common_v1.o
|
||||
OBJS += dma_common_l1f013.o
|
||||
OBJS += exti_common_all.o
|
||||
OBJS += flash.o flash_common_all.o flash_common_f.o flash_common_f01.o
|
||||
|
||||
@@ -97,7 +97,7 @@ It is locked by default on reset.
|
||||
|
||||
void flash_unlock_upper(void)
|
||||
{
|
||||
if (DESIG_FLASH_SIZE > 512) {
|
||||
if (desig_get_flash_size() > 512) {
|
||||
|
||||
/* Clear the unlock state. */
|
||||
FLASH_CR2 |= FLASH_CR_LOCK;
|
||||
@@ -126,7 +126,7 @@ void flash_lock_upper(void)
|
||||
|
||||
void flash_clear_pgerr_flag_upper(void)
|
||||
{
|
||||
if (DESIG_FLASH_SIZE > 512) {
|
||||
if (desig_get_flash_size() > 512) {
|
||||
FLASH_SR2 |= FLASH_SR_PGERR;
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ void flash_clear_pgerr_flag_upper(void)
|
||||
|
||||
void flash_clear_eop_flag_upper(void)
|
||||
{
|
||||
if (DESIG_FLASH_SIZE > 512) {
|
||||
if (desig_get_flash_size() > 512) {
|
||||
FLASH_SR2 |= FLASH_SR_EOP;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ void flash_clear_eop_flag_upper(void)
|
||||
|
||||
void flash_clear_wrprterr_flag_upper(void)
|
||||
{
|
||||
if (DESIG_FLASH_SIZE > 512) {
|
||||
if (desig_get_flash_size() > 512) {
|
||||
FLASH_SR2 |= FLASH_SR_WRPRTERR;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void flash_clear_status_flags(void)
|
||||
flash_clear_pgerr_flag();
|
||||
flash_clear_eop_flag();
|
||||
flash_clear_wrprterr_flag();
|
||||
if (DESIG_FLASH_SIZE > 512) {
|
||||
if (desig_get_flash_size() > 512) {
|
||||
flash_clear_pgerr_flag_upper();
|
||||
flash_clear_eop_flag_upper();
|
||||
flash_clear_wrprterr_flag_upper();
|
||||
@@ -192,7 +192,7 @@ uint32_t flash_get_status_flags(void)
|
||||
FLASH_SR_EOP |
|
||||
FLASH_SR_WRPRTERR |
|
||||
FLASH_SR_BSY));
|
||||
if (DESIG_FLASH_SIZE > 512) {
|
||||
if (desig_get_flash_size() > 512) {
|
||||
flags |= (FLASH_SR2 & (FLASH_SR_PGERR |
|
||||
FLASH_SR_EOP |
|
||||
FLASH_SR_WRPRTERR |
|
||||
@@ -219,7 +219,7 @@ void flash_program_half_word(uint32_t address, uint16_t data)
|
||||
{
|
||||
flash_wait_for_last_operation();
|
||||
|
||||
if ((DESIG_FLASH_SIZE > 512) && (address >= FLASH_BASE+0x00080000)) {
|
||||
if ((desig_get_flash_size() > 512) && (address >= FLASH_BASE+0x00080000)) {
|
||||
FLASH_CR2 |= FLASH_CR_PG;
|
||||
} else {
|
||||
FLASH_CR |= FLASH_CR_PG;
|
||||
@@ -229,7 +229,7 @@ void flash_program_half_word(uint32_t address, uint16_t data)
|
||||
|
||||
flash_wait_for_last_operation();
|
||||
|
||||
if ((DESIG_FLASH_SIZE > 512) && (address >= FLASH_BASE+0x00080000)) {
|
||||
if ((desig_get_flash_size() > 512) && (address >= FLASH_BASE+0x00080000)) {
|
||||
FLASH_CR2 &= ~FLASH_CR_PG;
|
||||
} else {
|
||||
FLASH_CR &= ~FLASH_CR_PG;
|
||||
@@ -253,7 +253,7 @@ void flash_erase_page(uint32_t page_address)
|
||||
{
|
||||
flash_wait_for_last_operation();
|
||||
|
||||
if ((DESIG_FLASH_SIZE > 512)
|
||||
if ((desig_get_flash_size() > 512)
|
||||
&& (page_address >= FLASH_BASE+0x00080000)) {
|
||||
FLASH_CR2 |= FLASH_CR_PER;
|
||||
FLASH_AR2 = page_address;
|
||||
@@ -266,7 +266,7 @@ void flash_erase_page(uint32_t page_address)
|
||||
|
||||
flash_wait_for_last_operation();
|
||||
|
||||
if ((DESIG_FLASH_SIZE > 512)
|
||||
if ((desig_get_flash_size() > 512)
|
||||
&& (page_address >= FLASH_BASE+0x00080000)) {
|
||||
FLASH_CR2 &= ~FLASH_CR_PER;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user