cpu/fe310: use common names for heap markers#14455
Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom Jul 8, 2020
Merged
Conversation
Other archs use `_sheap` and `_eheap` to mark the start and end of the heap. fe310 uses `_heap_start` and `_heap_end`, so platform independent code that wants to make use of this will needlessly fail. For compatibility with common code, name them the same on fe310.
aabadie
approved these changes
Jul 8, 2020
Contributor
aabadie
left a comment
There was a problem hiding this comment.
Built and run tests/heap_cmd on hifive1b: firmwares have the same size, values returned by the heap command are the same.
this PR
$ RIOT_VERSION=test make BOARD=hifive1b -C tests/heap_cmd/ flash term -j
make: Entering directory '/work/riot/RIOT/tests/heap_cmd'
Building application "tests_heap_cmd" for "hifive1b" with MCU "fe310".
"make" -C /work/riot/RIOT/boards/hifive1b
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/fe310
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/cpu/fe310/nano
"make" -C /work/riot/RIOT/cpu/fe310/periph
"make" -C /work/riot/RIOT/cpu/fe310/vendor
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/isrpipe
"make" -C /work/riot/RIOT/sys/ps
"make" -C /work/riot/RIOT/sys/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/stdio_uart
"make" -C /work/riot/RIOT/sys/test_utils/interactive_sync
"make" -C /work/riot/RIOT/sys/tsrb
text data bss dec hex filename
14541 488 2512 17541 4485 /work/riot/RIOT/tests/heap_cmd/bin/hifive1b/tests_heap_cmd.elf
/work/riot/RIOT/dist/tools/jlink/jlink.sh flash /work/riot/RIOT/tests/heap_cmd/bin/hifive1b/tests_heap_cmd.bin
### Flashing Target ###
### Flashing at base address 0x20010000 with offset 0 ###
SEGGER J-Link Commander V6.56d (Compiled Dec 12 2019 13:05:00)
DLL version V6.56d, compiled Dec 12 2019 13:04:51
J-Link Commander will now exit on Error
J-Link Command File read successfully.
Processing script file...
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link OB-K22-SiFive compiled Dec 12 2019 16:26:28
Hardware version: V1.00
S/N: 979001370
VTref=3.300V
Target connection not established yet but required for command.
Device "FE310" selected.
Connecting to target via JTAG
ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
Temp. halted CPU for NumHWBP detection
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V identified.
Halting CPU for downloading file.
Downloading file [/work/riot/RIOT/tests/heap_cmd/bin/hifive1b/tests_heap_cmd.bin]...
Comparing flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x20000000: Skipped. Contents already match
O.K.
Reset delay: 0 ms
Reset type Normal: Resets core & peripherals using <ndmreset> bit in <dmcontrol> debug register.
Script processing completed.
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-07-08 14:11:54,899 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Bench Clock Reset Complete
2020-07-08 14:11:55,925 #
2020-07-08 14:11:56,077 # ATE0-->OK
2020-07-08 14:11:56,234 # AT+BLEINIT=0-->OK
2020-07-08 14:11:56,390 # AT+CWMODE=0-->OK
2020-07-08 14:11:56,391 #
2020-07-08 14:11:56,399 # main(): This is RIOT! (Version: test)
2020-07-08 14:11:56,403 # Shell-based test application for heap functions.
2020-07-08 14:11:56,409 # Use the 'help' command to get more information on how to use it.
> heap
2020-07-08 14:11:58,117 # heap
2020-07-08 14:11:58,120 # heap: 13384 (used 1468, free 11916) [bytes]
> 2020-07-08 14:13:57,027 # Exiting Pyterm
master
$ RIOT_VERSION=test make BOARD=hifive1b -C tests/heap_cmd/ flash term -j
make: Entering directory '/work/riot/RIOT/tests/heap_cmd'
Building application "tests_heap_cmd" for "hifive1b" with MCU "fe310".
"make" -C /work/riot/RIOT/boards/hifive1b
"make" -C /work/riot/RIOT/core
"make" -C /work/riot/RIOT/cpu/fe310
"make" -C /work/riot/RIOT/drivers
"make" -C /work/riot/RIOT/sys
"make" -C /work/riot/RIOT/drivers/periph_common
"make" -C /work/riot/RIOT/sys/auto_init
"make" -C /work/riot/RIOT/sys/isrpipe
"make" -C /work/riot/RIOT/sys/ps
"make" -C /work/riot/RIOT/sys/shell
"make" -C /work/riot/RIOT/sys/shell/commands
"make" -C /work/riot/RIOT/sys/stdio_uart
"make" -C /work/riot/RIOT/sys/test_utils/interactive_sync
"make" -C /work/riot/RIOT/sys/tsrb
"make" -C /work/riot/RIOT/cpu/fe310/nano
"make" -C /work/riot/RIOT/cpu/fe310/periph
"make" -C /work/riot/RIOT/cpu/fe310/vendor
text data bss dec hex filename
14541 488 2512 17541 4485 /work/riot/RIOT/tests/heap_cmd/bin/hifive1b/tests_heap_cmd.elf
/work/riot/RIOT/dist/tools/jlink/jlink.sh flash /work/riot/RIOT/tests/heap_cmd/bin/hifive1b/tests_heap_cmd.bin
### Flashing Target ###
### Flashing at base address 0x20010000 with offset 0 ###
SEGGER J-Link Commander V6.56d (Compiled Dec 12 2019 13:05:00)
DLL version V6.56d, compiled Dec 12 2019 13:04:51
J-Link Commander will now exit on Error
J-Link Command File read successfully.
Processing script file...
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link OB-K22-SiFive compiled Dec 12 2019 16:26:28
Hardware version: V1.00
S/N: 979001370
VTref=3.300V
Target connection not established yet but required for command.
Device "FE310" selected.
Connecting to target via JTAG
ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
Temp. halted CPU for NumHWBP detection
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V identified.
Halting CPU for downloading file.
Downloading file [/work/riot/RIOT/tests/heap_cmd/bin/hifive1b/tests_heap_cmd.bin]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x20000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total time needed: 0.577s (Prepare: 0.103s, Compare: 0.034s, Erase: 0.156s, Program: 0.228s, Verify: 0.036s, Restore: 0.018s)
O.K.
Reset delay: 0 ms
Reset type Normal: Resets core & peripherals using <ndmreset> bit in <dmcontrol> debug register.
Script processing completed.
/work/riot/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2020-07-08 14:11:31,884 # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Bench Clock Reset Complete
2020-07-08 14:11:32,917 #
2020-07-08 14:11:33,058 # ATE0-->ATE0
2020-07-08 14:11:33,075 # OK
2020-07-08 14:11:33,232 # AT+BLEINIT=0-->OK
2020-07-08 14:11:33,388 # AT+CWMODE=0-->OK
2020-07-08 14:11:33,389 #
2020-07-08 14:11:33,397 # main(): This is RIOT! (Version: test)
2020-07-08 14:11:33,402 # Shell-based test application for heap functions.
2020-07-08 14:11:33,407 # Use the 'help' command to get more information on how to use it.
> help
2020-07-08 14:11:34,964 # help
2020-07-08 14:11:34,967 # Command Description
2020-07-08 14:11:34,970 # ---------------------------------------
2020-07-08 14:11:34,973 # malloc malloc <size>
2020-07-08 14:11:34,980 # free free <addr in hex> returned from malloc, e.g., 0x1234
2020-07-08 14:11:34,983 # reboot Reboot the node
2020-07-08 14:11:34,987 # version Prints current RIOT_VERSION
2020-07-08 14:11:34,991 # heap Prints heap statistics.
2020-07-08 14:11:34,996 # pm interact with layered PM subsystem
2020-07-08 14:11:35,001 # ps Prints information about running threads.
> heap
2020-07-08 14:11:38,444 # heap
2020-07-08 14:11:38,448 # heap: 13384 (used 1468, free 11916) [bytes]
> 2020-07-08 14:11:44,553 # Exiting Pyterm
ACK
3 tasks
This file contains hidden or 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
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.
Contribution description
Other archs use
_sheapand_eheapto mark the start and end of the heap.fe310 uses
_heap_startand_heap_end, so platform independent code that wants to make use of this will needlessly fail.For compatibility with common code, name them the same on fe310.
Testing procedure
Only variable names changed, the same binary should still be generated.
Issues/PRs references
previous PR #12328
came up again in #12305 (comment)