diff --git a/.cproject b/.cproject
index 484ea0a..03d44f1 100644
--- a/.cproject
+++ b/.cproject
@@ -78,7 +78,8 @@
-
+
+
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 073aca8..dcd5003 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/Debug/src/subdir.mk b/Debug/src/subdir.mk
index 97d5312..cc9bc79 100644
--- a/Debug/src/subdir.mk
+++ b/Debug/src/subdir.mk
@@ -9,7 +9,9 @@ C_SRCS += \
../src/PathConfig.c \
../src/TimerConfig.c \
../src/_write.c \
-../src/config_data.c \
+../src/config_data_first.c \
+../src/config_data_second.c \
+../src/config_data_third.c \
../src/delay.c \
../src/io.c \
../src/it_handlers.c \
@@ -30,7 +32,9 @@ OBJS += \
./src/PathConfig.o \
./src/TimerConfig.o \
./src/_write.o \
-./src/config_data.o \
+./src/config_data_first.o \
+./src/config_data_second.o \
+./src/config_data_third.o \
./src/delay.o \
./src/io.o \
./src/it_handlers.o \
@@ -51,7 +55,9 @@ C_DEPS += \
./src/PathConfig.d \
./src/TimerConfig.d \
./src/_write.d \
-./src/config_data.d \
+./src/config_data_first.d \
+./src/config_data_second.d \
+./src/config_data_third.d \
./src/delay.d \
./src/io.d \
./src/it_handlers.d \
diff --git a/ldscripts/sections.ld b/ldscripts/sections.ld
index 48086cc..3ef13ed 100644
--- a/ldscripts/sections.ld
+++ b/ldscripts/sections.ld
@@ -234,6 +234,50 @@ SECTIONS
_etext = .;
__etext = .;
+ __config_section_first_start = 0x0801E800;
+ __config_section_second_start = 0x0801F000;
+ __config_section_third_start = 0x0801F800;
+
+ __config_section_first_end = __config_section_first_start + 0x7FF;
+ __config_section_second_end = __config_section_second_start + 0x7FF;
+ __config_section_third_end = __config_section_third_start + 0x7FF;
+
+ .config_section_first __config_section_first_start : ALIGN(4)
+ {
+ FILL(0xAB)
+
+ *(.config_section_first) config_data_mode_first = __config_section_first_start;
+ *(.config_section_first) config_data_basic_first = __config_section_first_start + 0x20;
+ *(.config_section_first) config_data_wx_sources_first = __config_section_first_start + 0x100;
+ *(.config_section_first) config_data_umb_first = __config_section_first_start + 0x120;
+ *(.config_section_first) config_data_rtu_first = __config_section_first_start + 0x140;
+
+ __config_section_first_crc = (__config_section_first_end - 0x4);
+
+ KEEP(*(.config_section_first))
+ } >FLASH
+
+ .config_section_second __config_section_second_start : ALIGN(4)
+ {
+ FILL(0xAC)
+
+
+ *(.config_section_second) config_data_mode_second = __config_section_second_start;
+ *(.config_section_second) config_data_basic_second = __config_section_second_start + 0x20;
+ *(.config_section_second) config_data_wx_sources_second = __config_section_second_start + 0x100;
+ *(.config_section_second) config_data_umb_second = __config_section_second_start + 0x120;
+ *(.config_section_second) config_data_rtu_second = __config_section_second_start + 0x140;
+
+ __config_section_second_crc = (__config_section_second_end - 0x4);
+
+ KEEP(*(.config_section_second))
+ } >FLASH
+
+ .config_section_third __config_section_third_start : ALIGN(4)
+ {
+ KEEP(*(.config_section_third))
+ } >FLASH
+
/* MEMORY_ARRAY */
/*
.ROarraySection :
diff --git a/src/config_data.c b/src/config_data_first.c
similarity index 93%
rename from src/config_data.c
rename to src/config_data_first.c
index d9e993b..462b965 100644
--- a/src/config_data.c
+++ b/src/config_data_first.c
@@ -43,7 +43,7 @@
/**
*
*/
-const config_data_mode_t config_data_mode_first = {
+const config_data_mode_t __attribute__((section(".config_section_first"))) config_data_mode_first = {
#ifdef _DIGI
.digi = 1,
#else
@@ -109,7 +109,7 @@ const config_data_mode_t config_data_mode_first = {
/**
*
*/
-const config_data_basic_t config_data_basic_first = {
+const config_data_basic_t __attribute__((section(".config_section_first"))) config_data_basic_first = {
.callsign = _CALL,
.ssid = _SSID,
.latitude = _LAT,
@@ -168,7 +168,7 @@ const config_data_basic_t config_data_basic_first = {
* Data sources for different parameters
*
*/
-const config_data_wx_sources_t config_data_wx_sources_first = {
+const config_data_wx_sources_t __attribute__((section(".config_section_first"))) config_data_wx_sources_first = {
#ifdef _TEMPERATURE_INTERNAL
.temperature = WX_SOURCE_INTERNAL,
#endif
@@ -233,7 +233,7 @@ const config_data_wx_sources_t config_data_wx_sources_first = {
/**
*
*/
-const config_data_umb_t config_data_umb_first = {
+const config_data_umb_t __attribute__((section(".config_section_first"))) config_data_umb_first = {
#ifdef _UMB_SLAVE_ID
.slave_id = _UMB_SLAVE_ID,
#else
@@ -265,7 +265,7 @@ const config_data_umb_t config_data_umb_first = {
/**
*
*/
-const config_data_rtu_t config_data_rtu_first = {
+const config_data_rtu_t __attribute__((section(".config_section_first"))) config_data_rtu_first = {
.slave_speed = _RTU_SLAVE_SPEED,
.slave_parity = _RTU_SLAVE_PARITY,
diff --git a/src/config_data_second.c b/src/config_data_second.c
new file mode 100644
index 0000000..af16b76
--- /dev/null
+++ b/src/config_data_second.c
@@ -0,0 +1,424 @@
+/*
+ * config_data_second.c
+ *
+ * Created on: Apr 26, 2021
+ * Author: mateusz
+ */
+
+#include "config_data.h"
+
+#include "station_config.h"
+
+#ifndef _RTU_SLAVE_LENGHT_1
+ #define _RTU_SLAVE_LENGHT_1 0x1
+#endif
+
+#ifndef _RTU_SLAVE_LENGHT_2
+ #define _RTU_SLAVE_LENGHT_2 0x1
+#endif
+
+#ifndef _RTU_SLAVE_LENGHT_3
+ #define _RTU_SLAVE_LENGHT_3 0x1
+#endif
+
+#ifndef _RTU_SLAVE_LENGHT_4
+ #define _RTU_SLAVE_LENGHT_4 0x1
+#endif
+
+#ifndef _RTU_SLAVE_LENGHT_5
+ #define _RTU_SLAVE_LENGHT_5 0x1
+#endif
+
+#ifndef _RTU_SLAVE_LENGHT_6
+ #define _RTU_SLAVE_LENGHT_6 0x1
+#endif
+
+/**
+ *
+ */
+const config_data_mode_t __attribute__((section(".config_section_second"))) config_data_mode_second = {
+#ifdef _DIGI
+ .digi = 1,
+#else
+ .digi = 0,
+#endif
+
+#ifdef _METEO
+ .wx = 1,
+#else
+ .wx = 0,
+#endif
+
+#ifdef _MODBUS_RTU
+ .wx_modbus = 1,
+#else
+ .wx_modbus = 0,
+#endif
+
+#ifdef _MODBUS_RTU
+ .wx_modbus = 1,
+#else
+ .wx_modbus = 0,
+#endif
+
+#ifdef _UMB_MASTER
+ .wx_umb = 1,
+#else
+ .wx_umb = 0,
+#endif
+
+
+#ifdef _VICTRON
+ .victron = 1,
+#else
+ .victron = 0,
+#endif
+
+#ifdef _SENSOR_BME280
+ .wx_ms5611_or_bme = 1,
+#else
+ .wx_ms5611_or_bme = 0,
+#endif
+
+#ifdef _DIGI_ONLY_789
+ .digi_only_ssids = 1,
+#else
+ .digi_only_ssids = 0,
+#endif
+
+#ifdef _DIGI_VISCOUS
+ .digi_viscous = 1,
+#else
+ .digi_viscous = 0,
+#endif
+
+#ifdef _DIGI_VISCOUS_DEALY
+ .digi_viscous_delay_sec = _DIGI_VISCOUS_DEALY
+#else
+ .digi_viscous_delay_sec = 3
+#endif
+};
+
+/**
+ *
+ */
+const config_data_basic_t __attribute__((section(".config_section_second"))) config_data_basic_second = {
+ .callsign = _CALL,
+ .ssid = _SSID,
+ .latitude = _LAT,
+ .longitude = _LON,
+#if (_LATNS == 'N')
+ .zero_to_n_one_to_s = 0,
+#else
+ .zero_to_n_one_to_s = 1,
+#endif
+
+#if (_LONWE == 'E')
+ .zero_to_e_one_to_w = 0,
+#else
+ .zero_to_e_one_to_w = 1,
+#endif
+
+ .comment = _COMMENT,
+
+#ifdef _SYMBOL_DIGI
+ .symbol = 0,
+#endif
+#ifdef _SYMBOL_WIDE1_DIGI
+ .symbol = 1,
+#endif
+#ifdef _SYMBOL_HOUSE
+ .symbol = 2,
+#endif
+#ifdef _SYMBOL_RXIGATE
+ .symbol = 3,
+#endif
+#ifdef _SYMBOL_IGATE
+ .symbol = 4,
+#endif
+
+#if defined(_WIDE1_PATH)
+ .path_type = 1,
+#elif defined(_WIDE21_PATH)
+ .path_type = 2,
+#else
+ .path_type = 0,
+#endif
+
+ .wx_transmit_period = _WX_INTERVAL,
+
+ .beacon_transmit_period = _BCN_INTERVAL,
+
+#ifdef _BCN_ON_STARTUP
+ .beacon_at_bootup = 1
+#else
+ .beacon_at_bootup = 0
+#endif
+
+};
+
+/**
+ * Data sources for different parameters
+ *
+ */
+const config_data_wx_sources_t __attribute__((section(".config_section_second"))) config_data_wx_sources_second = {
+#ifdef _TEMPERATURE_INTERNAL
+ .temperature = WX_SOURCE_INTERNAL,
+#endif
+#ifdef _TEMPERATURE_UMB
+ .temperature = WX_SOURCE_UMB,
+#endif
+#ifdef _TEMPERATURE_RTU
+ .temperature = WX_SOURCE_RTU,
+#endif
+#ifdef _TEMPERATURE_DAVIS
+ .temperature = WX_SOURCE_DAVIS_SERIAL,
+#endif
+
+
+
+#ifdef _PRESSURE_INTERNAL
+ .pressure = WX_SOURCE_INTERNAL,
+#endif
+#ifdef _PRESSURE_UMB
+ .pressure = WX_SOURCE_UMB,
+#endif
+#ifdef _PRESSURE_RTU
+ .pressure = WX_SOURCE_RTU,
+#endif
+#ifdef _PRESSURE_DAVIS
+ .pressure = WX_SOURCE_DAVIS_SERIAL,
+#endif
+
+
+#ifdef _HUMIDITY_INTERNAL
+ .humidity = WX_SOURCE_INTERNAL,
+#endif
+#ifdef _HUMIDITY_UMB
+ .humidity = WX_SOURCE_UMB,
+#endif
+#ifdef _HUMIDITY_RTU
+ .humidity = WX_SOURCE_RTU,
+#endif
+#ifdef _HUMIDITY_DAVIS
+ .humidity = WX_SOURCE_DAVIS_SERIAL,
+#endif
+
+
+
+#ifdef _WIND_INTERNAL
+ .wind = WX_SOURCE_INTERNAL
+#endif
+#ifdef _WIND_UMB
+ .wind = WX_SOURCE_UMB
+#endif
+#ifdef _WIND_RTU
+ .wind = WX_SOURCE_RTU
+#endif
+#ifdef _WIND_FULL_RTU
+ .wind = WX_SOURCE_FULL_RTU
+#endif
+#ifdef _WIND_DAVIS
+ .wind = WX_SOURCE_DAVIS_SERIAL
+#endif
+};
+
+/**
+ *
+ */
+const config_data_umb_t __attribute__((section(".config_section_second"))) config_data_umb_second = {
+#ifdef _UMB_SLAVE_ID
+ .slave_id = _UMB_SLAVE_ID,
+#else
+ .slave_id = 0,
+#endif
+
+#ifdef _UMB_SLAVE_CLASS
+ .slave_class = _UMB_SLAVE_CLASS,
+#else
+ .slave_class = 0,
+#endif
+
+#if defined (_UMB_SLAVE_ID) && defined (_UMB_SLAVE_CLASS)
+ .channel_windspeed = _UMB_CHANNEL_WINDSPEED,
+ .channel_wingsusts = _UMB_CHANNEL_WINDGUSTS,
+ .channel_winddirection = _UMB_CHANNEL_WINDDIRECTION,
+ .channel_temperature = _UMB_CHANNEL_TEMPERATURE,
+ .channel_qnh = _UMB_CHANNEL_QFE
+#else
+ .channel_windspeed = 0xFFFF,
+ .channel_wingsusts = 0xFFFF,
+ .channel_winddirection = 0xFFFF,
+ .channel_temperature = 0xFFFF,
+ .channel_qfe = 0xFFFF
+#endif
+};
+
+
+/**
+ *
+ */
+const config_data_rtu_t __attribute__((section(".config_section_second"))) config_data_rtu_second = {
+ .slave_speed = _RTU_SLAVE_SPEED,
+
+ .slave_parity = _RTU_SLAVE_PARITY,
+
+ .slave_stop_bits = _RTU_SLAVE_STOP_BITS,
+
+#ifdef _RTU_SLAVE_FULL_WIND_DATA
+ .use_full_wind_data = 1,
+#else
+ .use_full_wind_data = 0,
+#endif
+
+ // sources
+#ifdef _RTU_SLAVE_TEMPERATURE_SOURCE
+ .temperature_source = _RTU_SLAVE_TEMPERATURE_SOURCE,
+#else
+ .temperature_source = 0,
+#endif
+
+#ifdef _RTU_SLAVE_HUMIDITY_SOURCE
+ .humidity_source = _RTU_SLAVE_HUMIDITY_SOURCE,
+#else
+ .humidity_source = 0,
+#endif
+
+#ifdef _RTU_SLAVE_PRESSURE_SOURCE
+ .pressure_source = _RTU_SLAVE_PRESSURE_SOURCE,
+#else
+ .pressure_source = 0,
+#endif
+
+#ifdef _RTU_SLAVE_WIND_DIRECTION_SORUCE
+ .wind_direction_source = _RTU_SLAVE_WIND_DIRECTION_SORUCE,
+#else
+ .wind_direction_source = 0,
+#endif
+
+#ifdef _RTU_SLAVE_WIND_SPEED_SOURCE
+ .wind_speed_source = _RTU_SLAVE_WIND_SPEED_SOURCE,
+#else
+ .wind_speed_source = 0,
+#endif
+
+#ifdef _RTU_SLAVE_WIND_GUSTS_SOURCE
+ .wind_gusts_source = _RTU_SLAVE_WIND_GUSTS_SOURCE,
+#else
+ .wind_gusts_source = 0,
+#endif
+
+ // channel 1
+ .slave_1_bus_address = _RTU_SLAVE_ID_1,
+
+ .slave_1_function = _RTU_SLAVE_FUNC_1,
+
+ .slave_1_register_address = _RTU_SLAVE_ADDR_1,
+
+ .slave_1_lenght = _RTU_SLAVE_LENGHT_1,
+
+ .slave_1_scaling_a = _RTU_SLAVE_SCALING_A_1,
+
+ .slave_1_scaling_b = _RTU_SLAVE_SCALING_B_1,
+
+ .slave_1_scaling_c = _RTU_SLAVE_SCALING_C_1,
+
+ .slave_1_scaling_d = _RTU_SLAVE_SCALING_D_1,
+
+ .slave_1_unsigned_signed = 0, // 0 - unsigned
+
+ // channel 2
+ .slave_2_bus_address = _RTU_SLAVE_ID_2,
+
+ .slave_2_function = _RTU_SLAVE_FUNC_2,
+
+ .slave_2_register_address = _RTU_SLAVE_ADDR_2,
+
+ .slave_2_lenght = _RTU_SLAVE_LENGHT_2,
+
+ .slave_2_scaling_a = _RTU_SLAVE_SCALING_A_2,
+
+ .slave_2_scaling_b = _RTU_SLAVE_SCALING_B_2,
+
+ .slave_2_scaling_c = _RTU_SLAVE_SCALING_C_2,
+
+ .slave_2_scaling_d = _RTU_SLAVE_SCALING_D_2,
+
+ .slave_2_unsigned_signed = 0,
+
+ // channel 3
+ .slave_3_bus_address = _RTU_SLAVE_ID_3,
+
+ .slave_3_function = _RTU_SLAVE_FUNC_3,
+
+ .slave_3_register_address = _RTU_SLAVE_ADDR_3,
+
+ .slave_3_lenght = _RTU_SLAVE_LENGHT_3,
+
+ .slave_3_scaling_a = _RTU_SLAVE_SCALING_A_3,
+
+ .slave_3_scaling_b = _RTU_SLAVE_SCALING_B_3,
+
+ .slave_3_scaling_c = _RTU_SLAVE_SCALING_C_3,
+
+ .slave_3_scaling_d = _RTU_SLAVE_SCALING_D_3,
+
+ .slave_3_unsigned_signed = 0,
+
+ // channel 4
+ .slave_4_bus_address = _RTU_SLAVE_ID_4,
+
+ .slave_4_function = _RTU_SLAVE_FUNC_4,
+
+ .slave_4_register_address = _RTU_SLAVE_ADDR_4,
+
+ .slave_4_lenght = _RTU_SLAVE_LENGHT_4,
+
+ .slave_4_scaling_a = _RTU_SLAVE_SCALING_A_4,
+
+ .slave_4_scaling_b = _RTU_SLAVE_SCALING_B_4,
+
+ .slave_4_scaling_c = _RTU_SLAVE_SCALING_C_4,
+
+ .slave_4_scaling_d = _RTU_SLAVE_SCALING_D_4,
+
+ .slave_4_unsigned_signed = 0,
+
+ // channel 5
+ .slave_5_bus_address = _RTU_SLAVE_ID_5,
+
+ .slave_5_function = _RTU_SLAVE_FUNC_5,
+
+ .slave_5_register_address = _RTU_SLAVE_ADDR_5,
+
+ .slave_5_lenght = _RTU_SLAVE_LENGHT_5,
+
+ .slave_5_scaling_a = _RTU_SLAVE_SCALING_A_5,
+
+ .slave_5_scaling_b = _RTU_SLAVE_SCALING_B_5,
+
+ .slave_5_scaling_c = _RTU_SLAVE_SCALING_C_5,
+
+ .slave_5_scaling_d = _RTU_SLAVE_SCALING_D_5,
+
+ .slave_5_unsigned_signed = 0,
+
+ // channel 6
+ .slave_6_bus_address = _RTU_SLAVE_ID_6,
+
+ .slave_6_function = _RTU_SLAVE_FUNC_6,
+
+ .slave_6_register_address = _RTU_SLAVE_ADDR_6,
+
+ .slave_6_lenght = _RTU_SLAVE_LENGHT_6,
+
+ .slave_6_scaling_a = _RTU_SLAVE_SCALING_A_6,
+
+ .slave_6_scaling_b = _RTU_SLAVE_SCALING_B_6,
+
+ .slave_6_scaling_c = _RTU_SLAVE_SCALING_C_6,
+
+ .slave_6_scaling_d = _RTU_SLAVE_SCALING_D_6,
+
+ .slave_6_unsigned_signed = 0
+};
diff --git a/src/config_data_third.c b/src/config_data_third.c
new file mode 100644
index 0000000..2a4dc6f
--- /dev/null
+++ b/src/config_data_third.c
@@ -0,0 +1,9 @@
+/*
+ * config_data_third.c
+ *
+ * Created on: Apr 26, 2021
+ * Author: mateusz
+ */
+
+const int __attribute__((section(".config_section_third"))) dummy = 0xDEADBEEF;
+