diff --git a/CMakeLists.txt b/CMakeLists.txt index c6bc336..6c97efa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,13 @@ -target_sources( - ${CMAKE_PROJECT_NAME} - PUBLIC +cmake_minimum_required(VERSION 3.15) +set(ETHERLIB_TARGET etherlib) + +if (ETHERLIB_TARGET_TAG) + set(ETHERLIB_TARGET "${ETHERLIB_TARGET}_${ETHERLIB_TARGET_TAG}") + message("Custom EtherLib target: ${ETHERLIB_TARGET}") +endif() + +set(ETHERLIB_SRC apps/http_server.c apps/http_server.h apps/ftp_server.c @@ -89,3 +95,18 @@ target_sources( utils.c utils.h ) + +add_library(${ETHERLIB_TARGET} STATIC ${ETHERLIB_SRC}) +target_include_directories(${ETHERLIB_TARGET} PRIVATE ${ETHERLIB_INCLUDES}) +target_compile_options(${ETHERLIB_TARGET} PRIVATE + ${ETHERLIB_CPU_PARAMS} + -Wall + -Wextra + #-Wpedantic + -Wno-unused-parameter + + $<$:-x assembler-with-cpp -MMD -MP> + $<$:-O0 -g3 -ggdb> + $<$:-Og -g0> +) +target_compile_definitions(${ETHERLIB_TARGET} PRIVATE ${ETHERLIB_COMPILE_DEFS}) \ No newline at end of file diff --git a/eth_interface.c b/eth_interface.c index 51812d9..ea2e585 100644 --- a/eth_interface.c +++ b/eth_interface.c @@ -122,15 +122,16 @@ static ThreadReturnType task_ethintf(ThreadParamType param) { } else { // if link is off dhcp_stop(intf->dhcp); } + + // print generic message + MSG("ETH LINK: %s%s", (ls ? (ANSI_COLOR_BGREEN "UP ") : (ANSI_COLOR_BRED "DOWN\n")), ANSI_COLOR_RESET); + + // print link properties + if (ls) { + MSG("(%u Mbps, %s duplex)\n", speed, duplex ? "FULL" : "HALF"); + } } - // print generic message - MSG("ETH LINK: %s%s", (ls ? (ANSI_COLOR_BGREEN "UP ") : (ANSI_COLOR_BRED "DOWN\n")), ANSI_COLOR_RESET); - - // print link properties - if (ls) { - MSG("(%u Mbps, %s duplex)\n", speed, duplex ? "FULL" : "HALF"); - } } break; case ETH_IIE_TRANSMIT_NOTIFY: { intf->ioDef->llTxTrigger(intf->ioDef, intf->txQ); @@ -280,4 +281,4 @@ void ethinf_print_info(const EthInterface * intf) { } MSG("\n"); -} +} \ No newline at end of file