summaryrefslogtreecommitdiffstats
path: root/ape
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-04-04 17:41:45 -0600
committerGitHub <noreply@github.com>2020-04-04 17:41:45 -0600
commit5f7bfbfc916b94d4176382646ab939f21c7ecfec (patch)
treeac3edf66f8f9ad203fd0b78a84e254716f52f1e0 /ape
parent39f2848259483ec4a5e54e418ea77032b2d7ffd0 (diff)
downloadbcm5719-ortega-5f7bfbfc916b94d4176382646ab939f21c7ecfec.tar.gz
bcm5719-ortega-5f7bfbfc916b94d4176382646ab939f21c7ecfec.zip
build: Build two firmware images with NC-SI locked to port 0 or port 2. (#73)
Diffstat (limited to 'ape')
-rw-r--r--ape/CMakeLists.txt40
-rw-r--r--ape/main.c10
2 files changed, 31 insertions, 19 deletions
diff --git a/ape/CMakeLists.txt b/ape/CMakeLists.txt
index 52dc3ef..a5892df 100644
--- a/ape/CMakeLists.txt
+++ b/ape/CMakeLists.txt
@@ -46,25 +46,33 @@
project(ape)
# Firmware
-set(LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/ape.ld")
-arm_add_executable(${PROJECT_NAME}
- main.c
- vectors.c
- rmu.c
- )
-arm_linker_script(${PROJECT_NAME} ${LINKER_SCRIPT})
+function(ape_firmware PORT)
+ SET(TARGET ${PROJECT_NAME}-port${PORT})
+ arm_add_executable(${TARGET}
+ main.c
+ vectors.c
+ rmu.c
+ )
+ arm_linker_script(${TARGET} "${CMAKE_CURRENT_SOURCE_DIR}/ape.ld")
-target_link_libraries(${PROJECT_NAME} NVRam-arm MII-arm APE-arm Network-arm NCSI-arm printf-arm)
-target_link_libraries(${PROJECT_NAME} bcm5719-arm)
-target_link_libraries(${PROJECT_NAME}
- --defsym=VERSION_MAJOR=${VERSION_MAJOR}
- --defsym=VERSION_MINOR=${VERSION_MINOR}
- --defsym=VERSION_PATCH=${VERSION_PATCH})
-target_compile_options(${PROJECT_NAME} PRIVATE -nodefaultlibs)
+ target_link_libraries(${TARGET} NVRam-arm MII-arm APE-arm Network-arm NCSI-arm printf-arm)
+ target_link_libraries(${TARGET} bcm5719-arm)
+ target_link_libraries(${TARGET}
+ --defsym=NETWORK_PORT=${PORT}
+ --defsym=VERSION_MAJOR=${VERSION_MAJOR}
+ --defsym=VERSION_MINOR=${VERSION_MINOR}
+ --defsym=VERSION_PATCH=${VERSION_PATCH})
+ target_compile_options(${TARGET} PRIVATE -nodefaultlibs)
+ target_compile_definitions(${TARGET} PRIVATE NETWORK_PORT=${PORT})
-format_target_sources(${PROJECT_NAME})
+ install(TARGETS ${TARGET} DESTINATION fw RESOURCE)
-install(TARGETS ${PROJECT_NAME} DESTINATION fw RESOURCE)
+endfunction()
+
+ape_firmware(0)
+ape_firmware(2)
+
+format_target_sources(${PROJECT_NAME}-port0)
# Simulator add_executable
# simulator_add_executable(sim-${PROJECT_NAME}
diff --git a/ape/main.c b/ape/main.c
index f0e3e21..f4db64a 100644
--- a/ape/main.c
+++ b/ape/main.c
@@ -64,6 +64,8 @@
#include <printf.h>
#endif
+static NetworkPort_t *gPort;
+
void handleCommand(void)
{
uint32_t command = SHM.LoaderCommand.bits.Command;
@@ -187,7 +189,7 @@ void handleBMCPacket(void)
else
{
// Pass through to network
- NetworkPort_t *port = &gPort;
+ NetworkPort_t *port = gPort;
if (port->shm_channel->NcsiChannelInfo.bits.Enabled)
{
if (!Network_TX_transmitPassthroughPacket(bytes, port))
@@ -274,8 +276,7 @@ void __attribute__((noreturn)) loaderLoop(void)
}
}
- NetworkPort_t *port = &gPort;
- Network_checkPortState(port);
+ Network_checkPortState(gPort);
}
}
@@ -346,6 +347,9 @@ void __attribute__((noreturn)) __start()
}
printf("APE v" STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." STRINGIFY(VERSION_PATCH) " NCSI Port " STRINGIFY(NETWORK_PORT) "\n");
+ gPort = Network_getPort(NETWORK_PORT);
+
+ NCSI_usePort(gPort);
checkSupply(true);
OpenPOWER on IntegriCloud