Skip to content

Commit

Permalink
Test workarounds for nRF52 and nRF52840.
Browse files Browse the repository at this point in the history
- Setting flags in cortex_test and gdb_test to indicate that
  nrf52 and nrf52840 will not fault on invalid accesses (in
  addition to nrf51).
- Workaround in connect_test to allow sleeping state as equivalent
  to running state, specifically for nRF52840-DK test binary.
- Added missing test binary for nRF52840-DK.
  • Loading branch information
flit committed Aug 11, 2018
1 parent f4b897e commit f3b2a62
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Binary file added binaries/l1_nrf52840-dk.bin
Binary file not shown.
5 changes: 4 additions & 1 deletion test/connect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def test_connect(halt_on_connect, expected_state, resume):
live_board.init()
print("Verifying target is", STATE_NAMES.get(expected_state, "unknown"))
actualState = live_board.target.getState()
if actualState == expected_state:
# Accept sleeping for running, as a hack to work around nRF52840-DK test binary.
# TODO remove sleeping hack.
if (actualState == expected_state) \
or (expected_state == RUNNING and actualState == Target.TARGET_SLEEPING):
passed = 1
print("TEST PASSED")
else:
Expand Down
14 changes: 8 additions & 6 deletions test/cortex_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ def cortex_test(board_id):

test_clock = 10000000
addr_invalid = 0x3E000000 # Last 16MB of ARM SRAM region - typically empty
if target_type == "nrf51":
expect_invalid_access_to_fail = True
if target_type in ("nrf51", "nrf52", "nrf52840"):
# Override clock since 10MHz is too fast
test_clock = 1000000
if target_type == "ncs36510":
expect_invalid_access_to_fail = False
elif target_type == "ncs36510":
# Override clock since 10MHz is too fast
test_clock = 1000000

Expand Down Expand Up @@ -183,7 +185,7 @@ def simulate_step():
target.readBlockMemoryUnaligned8(addr_invalid, 0x1000)
target.flush()
# If no exception is thrown the tests fails except on nrf51 where invalid addresses read as 0
if target_type != "nrf51":
if expect_invalid_access_to_fail:
memory_access_pass = False
except DAPAccess.TransferFaultError:
pass
Expand All @@ -192,7 +194,7 @@ def simulate_step():
target.readBlockMemoryUnaligned8(addr_invalid + 1, 0x1000)
target.flush()
# If no exception is thrown the tests fails except on nrf51 where invalid addresses read as 0
if target_type != "nrf51":
if expect_invalid_access_to_fail:
memory_access_pass = False
except DAPAccess.TransferFaultError:
pass
Expand All @@ -202,7 +204,7 @@ def simulate_step():
target.writeBlockMemoryUnaligned8(addr_invalid, data)
target.flush()
# If no exception is thrown the tests fails except on nrf51 where invalid addresses read as 0
if target_type != "nrf51":
if expect_invalid_access_to_fail:
memory_access_pass = False
except DAPAccess.TransferFaultError:
pass
Expand All @@ -212,7 +214,7 @@ def simulate_step():
target.writeBlockMemoryUnaligned8(addr_invalid + 1, data)
target.flush()
# If no exception is thrown the tests fails except on nrf51 where invalid addresses read as 0
if target_type != "nrf51":
if expect_invalid_access_to_fail:
memory_access_pass = False
except DAPAccess.TransferFaultError:
pass
Expand Down
2 changes: 1 addition & 1 deletion test/gdb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_gdb(board_id=None, n=0):
# Hardware breakpoints are not supported above 0x20000000 on
# CortexM devices
ignore_hw_bkpt_result = 1 if ram_region.start >= 0x20000000 else 0
if target_type == "nrf51":
if target_type in ("nrf51", "nrf52", "nrf52840"):
# Override clock since 10MHz is too fast
test_clock = 1000000
# Reading invalid ram returns 0 or nrf51
Expand Down

0 comments on commit f3b2a62

Please sign in to comment.