diff options
author | Evan Lojewski <github@meklort.com> | 2018-05-17 20:30:32 -0600 |
---|---|---|
committer | Evan Lojewski <github@meklort.com> | 2018-05-17 20:30:32 -0600 |
commit | a1c67aead537b98a70ab85ed2f38d2d732855176 (patch) | |
tree | 2c6e9e6660f5127155a52b77194587bc58ce5f08 | |
parent | 138b40dbe81e245cdff3766526a6bb3c82aadb99 (diff) | |
download | bcm5719-ortega-a1c67aead537b98a70ab85ed2f38d2d732855176.tar.gz bcm5719-ortega-a1c67aead537b98a70ab85ed2f38d2d732855176.zip |
Begin setting up buidl system to build fw, tests, and utils.
-rw-r--r-- | .gitmodules | 4 | ||||
-rw-r--r-- | CMakeLists.common.txt | 65 | ||||
-rw-r--r-- | CMakeLists.txt | 34 | ||||
-rw-r--r-- | MakeRulesOverwrite.cmake | 1 | ||||
-rw-r--r-- | cmake/FirmwareMakeRulesOverwrite.cmake | 2 | ||||
-rw-r--r-- | cmake/SimulatorMakeRulesOverwrite.cmake | 10 | ||||
-rw-r--r-- | ipxact/bcm5719.xml | 45 | ||||
-rw-r--r-- | libs/NVRam/nvm.c | 7 | ||||
-rw-r--r-- | stage0/init_hw.c | 0 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 46 | ||||
m--------- | tests/googletest | 0 | ||||
-rw-r--r-- | utils/bcmregtool/CMakeLists.txt | 2 |
12 files changed, 200 insertions, 16 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3005b84 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "tests/googletest"] + path = tests/googletest + url = https://github.com/google/googletest.git + branch = master diff --git a/CMakeLists.common.txt b/CMakeLists.common.txt new file mode 100644 index 0000000..25ab9d2 --- /dev/null +++ b/CMakeLists.common.txt @@ -0,0 +1,65 @@ +################################################################################ +### +### @file CMakeLists.txt +### +### @project +### +### @brief Top level CMake file +### +################################################################################ +### +################################################################################ +### +### @copyright Copyright (c) 2018, Evan Lojewski +### @cond +### +### All rights reserved. +### +### Redistribution and use in source and binary forms, with or without +### modification, are permitted provided that the following conditions are met: +### 1. Redistributions of source code must retain the above copyright notice, +### this list of conditions and the following disclaimer. +### 2. Redistributions in binary form must reproduce the above copyright notice, +### this list of conditions and the following disclaimer in the documentation +### and/or other materials provided with the distribution. +### 3. Neither the name of the copyright holder nor the +### names of its contributors may be used to endorse or promote products +### derived from this software without specific prior written permission. +### +################################################################################ +### +### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +### AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +### IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +### ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +### LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +### CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +### SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +### INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +### CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +### ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +### POSSIBILITY OF SUCH DAMAGE. +### @endcond +################################################################################ + +project(bcm5719-fw) + +cmake_minimum_required(VERSION 3.11) + +add_definitions(-Werror -Wall) + +IF(SIMULATOR) +add_definitions(-DCXX_SIMULATOR) +add_subdirectory(simulator) +add_subdirectory(utils) +ENDIF(SIMULATOR) + +add_subdirectory(libs) + + +IF(SIMULATOR) +add_subdirectory(tests) +ENDIF(SIMULATOR) + +# add_subdirectory(bcmflash) +# add_subdirectory(bcmfwtool) diff --git a/CMakeLists.txt b/CMakeLists.txt index e525f2b..55ec1f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ ################################################################################ ### -### @file libs/CMakeLists.txt +### @file CMakeLists.txt ### ### @project ### -### @brief Library CMake file +### @brief Top level CMake file ### ################################################################################ ### @@ -42,18 +42,30 @@ ### @endcond ################################################################################ -project(bcm5719-fw) - -set(SIMULATOR True) cmake_minimum_required(VERSION 3.11) -add_definitions(-Werror -Wall -DCXX_SIMULATOR) +# SET(CMAKE_INSTALL_PREFIX=) + +IF(NOT DOES_BUILD) -add_subdirectory(simulator) +include(ExternalProject) -add_subdirectory(libs) +ExternalProject_Add(simulator + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + CMAKE_ARGS -DCMAKE_USER_MAKE_RULES_OVERRIDE=cmake/SimulatorMakeRulesOverwrite.cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/ + USES_TERMINAL_BUILD 1 + USES_TERMINAL_CONFIGURE 1 + USES_TERMINAL_INSTALL 1 +) -add_subdirectory(utils) +ExternalProject_Add(firmware + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} + CMAKE_ARGS -DCMAKE_USER_MAKE_RULES_OVERRIDE=cmake/FirmwareMakeRulesOverwrite.cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/fw + USES_TERMINAL_BUILD 1 + USES_TERMINAL_CONFIGURE 1 + USES_TERMINAL_INSTALL 1 +) -# add_subdirectory(bcmflash) -# add_subdirectory(bcmfwtool) +ELSE() +include(CMakeLists.common.txt) +ENDIF()
\ No newline at end of file diff --git a/MakeRulesOverwrite.cmake b/MakeRulesOverwrite.cmake deleted file mode 100644 index e1d6095..0000000 --- a/MakeRulesOverwrite.cmake +++ /dev/null @@ -1 +0,0 @@ -list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS c) diff --git a/cmake/FirmwareMakeRulesOverwrite.cmake b/cmake/FirmwareMakeRulesOverwrite.cmake new file mode 100644 index 0000000..a5e1d3a --- /dev/null +++ b/cmake/FirmwareMakeRulesOverwrite.cmake @@ -0,0 +1,2 @@ + +set(DOES_BUILD True) diff --git a/cmake/SimulatorMakeRulesOverwrite.cmake b/cmake/SimulatorMakeRulesOverwrite.cmake new file mode 100644 index 0000000..1feb72b --- /dev/null +++ b/cmake/SimulatorMakeRulesOverwrite.cmake @@ -0,0 +1,10 @@ +list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS c) + +set(DOES_BUILD True) + +# Simulator build +set(SIMULATOR True) + +#Don't install the gtest libraries - we will link directly as needed. +SET(INSTALL_GTEST False CACHE BOOL "Disable GTest Install") +SET(INSTALL_GMOCK False CACHE BOOL "Disable GMock Install") diff --git a/ipxact/bcm5719.xml b/ipxact/bcm5719.xml index ad773a0..25edc33 100644 --- a/ipxact/bcm5719.xml +++ b/ipxact/bcm5719.xml @@ -631,6 +631,45 @@ <ipxact:access>read-write</ipxact:access> </ipxact:field> </ipxact:register> + + <ipxact:register> + <ipxact:name>GEN_DBG_CONTROL_STATUS</ipxact:name> + <ipxact:description>Firmware Debug Control</ipxact:description> + <ipxact:addressOffset>0x360</ipxact:addressOffset> + <!-- LINK: registerDefinitionGroup: see 6.11.3, Register definition group --> + <ipxact:size>32</ipxact:size> + <ipxact:volatile>true</ipxact:volatile> + <ipxact:field> + <ipxact:name>Debug Enabled</ipxact:name> + <ipxact:description></ipxact:description> + <ipxact:bitOffset>0</ipxact:bitOffset> + <ipxact:bitWidth>1</ipxact:bitWidth> + <ipxact:access>read-write</ipxact:access> + </ipxact:field> + <ipxact:field> + <ipxact:name>Data Available</ipxact:name> + <ipxact:description></ipxact:description> + <ipxact:bitOffset>8</ipxact:bitOffset> + <ipxact:bitWidth>1</ipxact:bitWidth> + <ipxact:access>read-write</ipxact:access> + </ipxact:field> + </ipxact:register> + <ipxact:register> + <ipxact:name>GEN_DBG_DATA</ipxact:name> + <ipxact:description>Firmware Debug Data</ipxact:description> + <ipxact:addressOffset>0x364</ipxact:addressOffset> + <!-- LINK: registerDefinitionGroup: see 6.11.3, Register definition group --> + <ipxact:size>32</ipxact:size> + <ipxact:volatile>true</ipxact:volatile> + <ipxact:field> + <ipxact:name>Debug Byte</ipxact:name> + <ipxact:description></ipxact:description> + <ipxact:bitOffset>0</ipxact:bitOffset> + <ipxact:bitWidth>8</ipxact:bitWidth> + <ipxact:access>read-write</ipxact:access> + </ipxact:field> + </ipxact:register> + </ipxact:addressBlock> <ipxact:addressUnitBits>8</ipxact:addressUnitBits> </ipxact:memoryMap> @@ -2813,8 +2852,7 @@ </ipxact:register> <ipxact:register> <ipxact:name>WOL_PATTERN_POINTER</ipxact:name> - <ipxact:description>Specifies the offset into the 6 KB BD memory for frame comparison. (Bits 3:0 are ignored to align -the memory address to a natural 128-bit boundary).</ipxact:description> + <ipxact:description>Specifies the offset into the 6 KB BD memory for frame comparison. (Bits 3:0 are ignored to align the memory address to a natural 128-bit boundary).</ipxact:description> <ipxact:addressOffset>0x430</ipxact:addressOffset> <!-- LINK: registerDefinitionGroup: see 6.11.3, Register definition group --> <ipxact:size>32</ipxact:size> @@ -3871,8 +3909,7 @@ the memory address to a natural 128-bit boundary).</ipxact:description> </ipxact:field> <ipxact:field> <ipxact:name>Enable Data Cache</ipxact:name> - <ipxact:description>Enables the data cache. Cleared on reset. -Note: Firmware developers should take care to clear this bit before polling internal SRAM memory locations, because the RX RISC processor uses a two-element LRU caching algorithm, which is not affected by writes from the PCI interface.</ipxact:description> + <ipxact:description>Enables the data cache. Cleared on reset. Note: Firmware developers should take care to clear this bit before polling internal SRAM memory locations, because the RX RISC processor uses a two-element LRU caching algorithm, which is not affected by writes from the PCI interface.</ipxact:description> <ipxact:bitOffset>5</ipxact:bitOffset> <ipxact:bitWidth>1</ipxact:bitWidth> <ipxact:access>read-write</ipxact:access> diff --git a/libs/NVRam/nvm.c b/libs/NVRam/nvm.c index 6322f10..af34a6f 100644 --- a/libs/NVRam/nvm.c +++ b/libs/NVRam/nvm.c @@ -53,9 +53,16 @@ #define PAGE_SIZE ATMEL_AT45DB0X1B_PAGE_SIZE #define NEEDS_ERASE ATMEL_AT45DB0X1B_ERASE +#ifdef CXX_SIMULATOR #define REQ ReqSet2 #define CLR ReqClr2 #define WON ArbWon2 +#else /* Firmware */ +#define REQ ReqSet0 +#define CLR ReqClr0 +#define WON ArbWon0 +#endif + /** * @fn uint32_t NVRam_translate(uint32_t address) diff --git a/stage0/init_hw.c b/stage0/init_hw.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/stage0/init_hw.c diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..d25830d --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,46 @@ +################################################################################ +### +### @file tests/CMakeLists.txt +### +### @project +### +### @brief Tests CMake file +### +################################################################################ +### +################################################################################ +### +### @copyright Copyright (c) 2018, Evan Lojewski +### @cond +### +### All rights reserved. +### +### Redistribution and use in source and binary forms, with or without +### modification, are permitted provided that the following conditions are met: +### 1. Redistributions of source code must retain the above copyright notice, +### this list of conditions and the following disclaimer. +### 2. Redistributions in binary form must reproduce the above copyright notice, +### this list of conditions and the following disclaimer in the documentation +### and/or other materials provided with the distribution. +### 3. Neither the name of the copyright holder nor the +### names of its contributors may be used to endorse or promote products +### derived from this software without specific prior written permission. +### +################################################################################ +### +### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +### AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +### IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +### ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +### LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +### CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +### SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +### INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +### CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +### ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +### POSSIBILITY OF SUCH DAMAGE. +### @endcond +################################################################################ + + +add_subdirectory(googletest) diff --git a/tests/googletest b/tests/googletest new file mode 160000 +Subproject 08d5b1f33af8c18785fb8ca02792b5fac81e248 diff --git a/utils/bcmregtool/CMakeLists.txt b/utils/bcmregtool/CMakeLists.txt index f1705af..fc97edc 100644 --- a/utils/bcmregtool/CMakeLists.txt +++ b/utils/bcmregtool/CMakeLists.txt @@ -9,3 +9,5 @@ add_executable(${PROJECT_NAME} ${SOURCES}) target_link_libraries(${PROJECT_NAME} PRIVATE NVRam) target_link_libraries(${PROJECT_NAME} PRIVATE simulator) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION .) |