-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for rp2040 powered by rp2040js emulator
Signed-off-by: Paul Guyot <[email protected]>
- Loading branch information
Showing
15 changed files
with
1,002 additions
and
1 deletion.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# This file is part of AtomVM. | ||
# | ||
# Copyright 2023 Paul Guyot <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | ||
# | ||
|
||
include(FetchContent) | ||
|
||
FetchContent_Declare( | ||
unity | ||
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git | ||
GIT_TAG v2.5.2 | ||
GIT_SHALLOW 1 | ||
) | ||
|
||
FetchContent_MakeAvailable(unity) |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,4 @@ set( | |
) | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(tests) |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# This file is part of AtomVM. | ||
# | ||
# Copyright 2023 Paul Guyot <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | ||
# | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# This file is part of AtomVM. | ||
# | ||
# Copyright 2023 Paul Guyot <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | ||
# | ||
|
||
cmake_minimum_required (VERSION 3.14) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../../CMakeModules") | ||
include(FetchUnity) | ||
|
||
add_executable(rp2040_tests test_main.c) | ||
|
||
target_compile_features(rp2040_tests PUBLIC c_std_11) | ||
if(CMAKE_COMPILER_IS_GNUCC) | ||
target_compile_options(rp2040_tests PUBLIC -ggdb) | ||
target_compile_options(rp2040_tests PRIVATE -Wall -pedantic -Wextra) | ||
endif() | ||
|
||
# libAtomVM needs to find Pico's platform_smp.h header | ||
set(HAVE_PLATFORM_SMP_H ON) | ||
target_link_libraries(rp2040_tests PUBLIC libAtomVM) | ||
# Also add lib where platform_smp.h header is | ||
target_include_directories(libAtomVM PUBLIC ../src/lib) | ||
|
||
target_link_libraries(rp2040_tests PUBLIC hardware_regs pico_stdlib pico_binary_info unity) | ||
|
||
set( | ||
PLATFORM_LIB_SUFFIX | ||
${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR} | ||
) | ||
|
||
target_link_libraries(rp2040_tests PRIVATE libAtomVM${PLATFORM_LIB_SUFFIX}) | ||
|
||
# could not get rp2040js to work with stdio USB | ||
pico_enable_stdio_usb(AtomVM 0) | ||
pico_enable_stdio_uart(AtomVM 1) | ||
|
||
# create map/bin/hex/uf2 file in addition to ELF. | ||
pico_add_extra_outputs(rp2040_tests) |
Oops, something went wrong.