boards: Change the linker generated symbols from uint32_t to uint8_t array

since the symbol generated by linker is always used as an address not a value.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-10-05 16:07:10 +08:00
committed by Petro Karashchenko
parent a7bca63b3b
commit 92f156c969
14 changed files with 52 additions and 81 deletions
@@ -75,14 +75,10 @@ __asm__ (
" .balign " STR(ROMFS_SECTOR_SIZE) "\n" " .balign " STR(ROMFS_SECTOR_SIZE) "\n"
" .globl romfs_data_end \n" " .globl romfs_data_end \n"
"romfs_data_end: \n" "romfs_data_end: \n"
" .globl romfs_data_size \n"
"romfs_data_size: \n"
" .word romfs_data_end - romfs_data_begin \n"
); );
extern const char romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const char romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -99,7 +95,7 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above. * ROMFS volume data, as included in the assembly snippet above.
* *
****************************************************************************/ ****************************************************************************/
@@ -111,9 +107,9 @@ int gd32_romfs_initialize(void)
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_GD32F4_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_GD32F4_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {
@@ -49,7 +49,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet in * ROMFS volume data, as included in the assembly snippet in
* gd32f4xx_romfs.c. * gd32f4xx_romfs.c.
* *
@@ -75,14 +75,10 @@ __asm__ (
\ \
".balign " STR(ROMFS_SECTOR_SIZE) "\n" ".balign " STR(ROMFS_SECTOR_SIZE) "\n"
".globl romfs_data_end\n" ".globl romfs_data_end\n"
"romfs_data_end:\n" "romfs_data_end:\n");
".globl romfs_data_size\n"
"romfs_data_size:\n"
".word romfs_data_end - romfs_data_begin\n");
extern const uint8_t romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const uint8_t romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -99,21 +95,21 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_en) should contain * Memory addresses [romfs_data_begin .. romfs_data_en) should contain
* ROMFS volume data, as included in the assembly snippet above. * ROMFS volume data, as included in the assembly snippet above.
* *
****************************************************************************/ ****************************************************************************/
int lpc17_40_romfs_initialize(void) int lpc17_40_romfs_initialize(void)
{ {
uintptr_t romfs_data_len; size_t romfs_data_len;
int ret; int ret;
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_LPC17_40_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_LPC17_40_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {
@@ -49,7 +49,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_end) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet in * ROMFS volume data, as included in the assembly snippet in
* lpc17_40_romfs_initialize.c. * lpc17_40_romfs_initialize.c.
* *
@@ -49,7 +49,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
@@ -77,14 +77,10 @@ __asm__ (
" .balign " STR(ROMFS_SECTOR_SIZE) "\n" " .balign " STR(ROMFS_SECTOR_SIZE) "\n"
" .globl romfs_data_end \n" " .globl romfs_data_end \n"
"romfs_data_end: \n" "romfs_data_end: \n"
" .globl romfs_data_size \n"
"romfs_data_size: \n"
" .word romfs_data_end - romfs_data_begin \n"
); );
extern const char romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const char romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -101,21 +97,21 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
int stm32_romfs_initialize(void) int stm32_romfs_initialize(void)
{ {
uintptr_t romfs_data_len; size_t romfs_data_len;
int ret; int ret;
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {
+1 -1
View File
@@ -64,7 +64,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
@@ -91,14 +91,10 @@ __asm__ (
\ \
".balign " STR(ROMFS_SECTOR_SIZE) "\n" ".balign " STR(ROMFS_SECTOR_SIZE) "\n"
".globl romfs_data_end\n" ".globl romfs_data_end\n"
"romfs_data_end:\n" "romfs_data_end:\n");
".globl romfs_data_size\n"
"romfs_data_size:\n"
".word romfs_data_end - romfs_data_begin\n");
extern const char romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const char romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -115,21 +111,21 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
int stm32_romfs_initialize(void) int stm32_romfs_initialize(void)
{ {
uintptr_t romfs_data_len size_t romfs_data_len
int ret; int ret;
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {
@@ -64,7 +64,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
@@ -91,15 +91,10 @@ __asm__ (
\ \
".balign " STR(ROMFS_SECTOR_SIZE) "\n" ".balign " STR(ROMFS_SECTOR_SIZE) "\n"
".globl romfs_data_end\n" ".globl romfs_data_end\n"
"romfs_data_end:\n" "romfs_data_end:\n");
".globl romfs_data_size\n"
"romfs_data_size:\n"
".word romfs_data_end - romfs_data_begin\n"
".previous\n");
extern const char romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const char romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -116,21 +111,21 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
int stm32_romfs_initialize(void) int stm32_romfs_initialize(void)
{ {
uintptr_t romfs_data_len; size_t romfs_data_len;
int ret; int ret;
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {
@@ -64,7 +64,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
@@ -91,14 +91,10 @@ __asm__ (
\ \
".balign " STR(ROMFS_SECTOR_SIZE) "\n" ".balign " STR(ROMFS_SECTOR_SIZE) "\n"
".globl romfs_data_end\n" ".globl romfs_data_end\n"
"romfs_data_end:\n" "romfs_data_end:\n");
".globl romfs_data_size\n"
"romfs_data_size:\n"
".word romfs_data_end - romfs_data_begin\n");
extern const char romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const char romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -115,21 +111,21 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
int stm32_romfs_initialize(void) int stm32_romfs_initialize(void)
{ {
uintptr_t romfs_data_len; size_t romfs_data_len;
int ret; int ret;
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {
@@ -49,7 +49,7 @@
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
@@ -75,14 +75,10 @@ __asm__ (
" .balign " STR(ROMFS_SECTOR_SIZE) "\n" " .balign " STR(ROMFS_SECTOR_SIZE) "\n"
" .globl romfs_data_end \n" " .globl romfs_data_end \n"
"romfs_data_end: \n" "romfs_data_end: \n"
" .globl romfs_data_size \n"
"romfs_data_size: \n"
" .word romfs_data_end - romfs_data_begin \n"
); );
extern const char romfs_data_begin; extern const uint8_t romfs_data_begin[];
extern const char romfs_data_end; extern const uint8_t romfs_data_end[];
extern const int romfs_data_size;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -99,21 +95,21 @@ extern const int romfs_data_size;
* Zero (OK) on success, a negated errno value on error. * Zero (OK) on success, a negated errno value on error.
* *
* Assumptions/Limitations: * Assumptions/Limitations:
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain * Memory addresses [romfs_data_begin .. romfs_data_end) should contain
* ROMFS volume data, as included in the assembly snippet above (l. 84). * ROMFS volume data, as included in the assembly snippet above (l. 84).
* *
****************************************************************************/ ****************************************************************************/
int stm32_romfs_initialize(void) int stm32_romfs_initialize(void)
{ {
uintptr_t romfs_data_len; size_t romfs_data_len;
int ret; int ret;
/* Create a ROM disk for the /etc filesystem */ /* Create a ROM disk for the /etc filesystem */
romfs_data_len = (uintptr_t)&romfs_data_end - (uintptr_t)&romfs_data_begin; romfs_data_len = romfs_data_end - romfs_data_begin;
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, &romfs_data_begin, ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE); NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
if (ret < 0) if (ret < 0)
{ {