-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
riscv: Fix build warning #2860
Merged
Merged
riscv: Fix build warning #2860
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This eliminates following warning: /tmp/ccfBOXIv.s: Assembler messages: /tmp/ccfBOXIv.s:6: Warning: setting incorrect section attributes for .data.fe310_flash_transmit /tmp/ccfBOXIv.s:41: Warning: setting incorrect section attributes for .data.fe310_flash_fifo_put /tmp/ccfBOXIv.s:89: Warning: setting incorrect section attributes for .data.fe310_flash_fifo_write /tmp/ccfBOXIv.s:145: Warning: setting incorrect section attributes for .data.fe310_flash_wait_till_ready /tmp/ccfBOXIv.s:194: Warning: setting incorrect section attributes for .data.fe310_flash_write_enable /tmp/ccfBOXIv.s:232: Warning: setting incorrect section attributes for .data.fe310_flash_write_page /tmp/ccfBOXIv.s:419: Warning: setting incorrect section attributes for .data.fe310_flash_erase_sector .data.XXXX section gets default attributes that are no executable renaming .data to .ram_text fixes assembler warning This requries change to linker script that now has to include .ram_text.XXXXX in data section to work as it used to before change
mlaz
approved these changes
Aug 3, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good
Style check summaryOur coding style is here!hw/mcu/sifive/fe310/src/hal_flash.c@@ -64,15 +64,15 @@
static int
fe310_flash_read(const struct hal_flash *dev, uint32_t address, void *dst,
- uint32_t num_bytes)
+ uint32_t num_bytes)
{
memcpy(dst, (void *)address, num_bytes);
return 0;
}
-static int __attribute((section(".ram_text.fe310_flash_transmit")))
-fe310_flash_transmit(uint8_t out_byte)
-{
+static int
+__attribute((section(".ram_text.fe310_flash_transmit")))
+fe310_flash_transmit(uint8_t out_byte) {
int in_byte;
/* Empty RX FIFO */
@@ -80,15 +80,15 @@
}
SPI0_REG(SPI_REG_TXFIFO) = out_byte;
do {
- in_byte = SPI0_REG(SPI_REG_RXFIFO);
+ in_byte = SPI0_REG(SPI_REG_RXFIFO);
} while (in_byte < 0);
return in_byte;
}
-static int __attribute((section(".ram_text.fe310_flash_fifo_put")))
-fe310_flash_fifo_put(uint8_t out_byte)
-{
+static int
+__attribute((section(".ram_text.fe310_flash_fifo_put")))
+fe310_flash_fifo_put(uint8_t out_byte) {
int went_out = 0;
/* Empty RX FIFO */
@@ -105,9 +105,9 @@
return went_out;
}
-static int __attribute((section(".ram_text.fe310_flash_fifo_write")))
-fe310_flash_fifo_write(const uint8_t *ptr, int count)
-{
+static int
+__attribute((section(".ram_text.fe310_flash_fifo_write")))
+fe310_flash_fifo_write(const uint8_t *ptr, int count) {
int went_out = 0;
while (count > 0) {
@@ -123,9 +123,9 @@
return went_out;
}
-static int __attribute((section(".ram_text.fe310_flash_wait_till_ready")))
-fe310_flash_wait_till_ready(void)
-{
+static int
+__attribute((section(".ram_text.fe310_flash_wait_till_ready")))
+fe310_flash_wait_till_ready(void) {
int status;
do {
SPI0_REG(SPI_REG_CSMODE) = SPI_CSMODE_HOLD;
@@ -138,19 +138,19 @@
return 0;
}
-static int __attribute((section(".ram_text.fe310_flash_write_enable")))
-fe310_flash_write_enable(void)
-{
+static int
+__attribute((section(".ram_text.fe310_flash_write_enable")))
+fe310_flash_write_enable(void) {
SPI0_REG(SPI_REG_CSMODE) = SPI_CSMODE_HOLD;
fe310_flash_transmit(FLASH_CMD_WRITE_ENABLE);
SPI0_REG(SPI_REG_CSMODE) = SPI_CSMODE_AUTO;
return 0;
}
-static int __attribute((section(".ram_text.fe310_flash_write_page"))) __attribute((noinline))
+static int
+__attribute((section(".ram_text.fe310_flash_write_page"))) __attribute((noinline))
fe310_flash_write_page(const struct hal_flash *dev, uint32_t address,
- const void *src, uint32_t num_bytes)
-{
+ const void *src, uint32_t num_bytes) {
int sr;
/* Number of bytes that left controller FIFO */
int went_out = 0;
@@ -232,9 +232,9 @@
return 0;
}
-static int __attribute((section(".ram_text.fe310_flash_erase_sector"))) __attribute((noinline))
-fe310_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_address)
-{
+static int
+__attribute((section(".ram_text.fe310_flash_erase_sector"))) __attribute((noinline))
+fe310_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_address) {
int sr;
__HAL_DISABLE_INTERRUPTS(sr);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This eliminates following warning:
/tmp/ccfBOXIv.s: Assembler messages:
/tmp/ccfBOXIv.s:6: Warning: setting incorrect section attributes for .data.fe310_flash_transmit
/tmp/ccfBOXIv.s:41: Warning: setting incorrect section attributes for .data.fe310_flash_fifo_put
/tmp/ccfBOXIv.s:89: Warning: setting incorrect section attributes for .data.fe310_flash_fifo_write
/tmp/ccfBOXIv.s:145: Warning: setting incorrect section attributes for .data.fe310_flash_wait_till_ready
/tmp/ccfBOXIv.s:194: Warning: setting incorrect section attributes for .data.fe310_flash_write_enable
/tmp/ccfBOXIv.s:232: Warning: setting incorrect section attributes for .data.fe310_flash_write_page
/tmp/ccfBOXIv.s:419: Warning: setting incorrect section attributes for .data.fe310_flash_erase_sector
.data.XXXX section gets default attributes that are no executable
renaming .data to .ram_text fixes assembler warning
This requries change to linker script that now has to include .ram_text.XXXXX in data section
to work as it used to before change