Skip to content

cpu/fe310: use common names for heap markers#14455

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
benpicco:fe310-heap_markers
Jul 8, 2020
Merged

cpu/fe310: use common names for heap markers#14455
aabadie merged 1 commit intoRIOT-OS:masterfrom
benpicco:fe310-heap_markers

Conversation

@benpicco
Copy link
Contributor

@benpicco benpicco commented Jul 7, 2020

Contribution description

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.

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)

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.
@benpicco benpicco added Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Jul 7, 2020
@benpicco benpicco requested review from bergzand and gschorcht July 7, 2020 15:27
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@aabadie aabadie merged commit d02d54b into RIOT-OS:master Jul 8, 2020
@benpicco benpicco deleted the fe310-heap_markers branch July 8, 2020 12:15
@miri64 miri64 added this to the Release 2020.07 milestone Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants