Skip to content

Commit

Permalink
Add network default config to F4 and F7 boards
Browse files Browse the repository at this point in the history
- Following #1422.
  • Loading branch information
josesimoes committed Nov 27, 2019
1 parent 27243c8 commit c2208fe
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# append common source files
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/usbcfg.c")
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Device_BlockStorage$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:-DEBUG>.c")
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/targetHAL_ConfigurationManager.cpp")

# make var global
set(COMMON_PROJECT_SOURCES ${COMMON_PROJECT_SOURCES} CACHE INTERNAL "make global")
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2019 The nanoFramework project contributors
// See LICENSE file in the project root for full license information.
//

#include <nanoHAL.h>
#include <nanoHAL_v2.h>
#include <nanoWeak.h>
#include <Target_BlockStorage_STM32FlashDriver.h>

// Default initialisation for Network interface config blocks
// strong implementation replacing ChibiOS 'weak' one
bool InitialiseNetworkDefaultConfig(HAL_Configuration_NetworkInterface * pconfig, uint32_t configurationIndex)
{
(void)configurationIndex;

// make sure the config block marker is set
memcpy(pconfig->Marker, c_MARKER_CONFIGURATION_NETWORK_V1, sizeof(c_MARKER_CONFIGURATION_NETWORK_V1));

pconfig->InterfaceType = NetworkInterfaceType_Ethernet;
pconfig->StartupAddressMode = AddressMode_DHCP;
pconfig->AutomaticDNS = 1;
pconfig->SpecificConfigId = 0;

// set MAC address with ST provided MAC for development boards
// 00:80:E1:01:35:D1
pconfig->MacAddress[0] = 0x00;
pconfig->MacAddress[1] = 0x80;
pconfig->MacAddress[2] = 0xE1;
pconfig->MacAddress[3] = 0x01;
pconfig->MacAddress[4] = 0x35;
pconfig->MacAddress[5] = 0xD1;

return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# append common source files
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/usbcfg.c")
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Device_BlockStorage$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:-DEBUG>.c")
list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/targetHAL_ConfigurationManager.cpp")

# make var global
set(COMMON_PROJECT_SOURCES ${COMMON_PROJECT_SOURCES} CACHE INTERNAL "make global")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2019 The nanoFramework project contributors
// See LICENSE file in the project root for full license information.
//

#include <nanoHAL.h>
#include <nanoHAL_v2.h>
#include <nanoWeak.h>
#include <Target_BlockStorage_STM32FlashDriver.h>

// Default initialisation for Network interface config blocks
// strong implementation replacing ChibiOS 'weak' one
bool InitialiseNetworkDefaultConfig(HAL_Configuration_NetworkInterface * pconfig, uint32_t configurationIndex)
{
(void)configurationIndex;

// make sure the config block marker is set
memcpy(pconfig->Marker, c_MARKER_CONFIGURATION_NETWORK_V1, sizeof(c_MARKER_CONFIGURATION_NETWORK_V1));

pconfig->InterfaceType = NetworkInterfaceType_Ethernet;
pconfig->StartupAddressMode = AddressMode_DHCP;
pconfig->AutomaticDNS = 1;
pconfig->SpecificConfigId = 0;

// set MAC address with ST provided MAC for development boards
// 00:80:E1:01:35:D1
pconfig->MacAddress[0] = 0x00;
pconfig->MacAddress[1] = 0x80;
pconfig->MacAddress[2] = 0xE1;
pconfig->MacAddress[3] = 0x01;
pconfig->MacAddress[4] = 0x35;
pconfig->MacAddress[5] = 0xD1;

return true;
}

0 comments on commit c2208fe

Please sign in to comment.