Skip to content

Commit d3f8c60

Browse files
Radoslaw, KudajRadoslaw, Kudaj
authored andcommitted
Adds support for nrf5340-DK board (application and networking core)
1 parent 80c3a84 commit d3f8c60

File tree

78 files changed

+18251
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+18251
-83
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,28 @@ BIN = _bin/$(BOARD)
108108
# Board specific
109109
-include src/boards/$(BOARD)/board.mk
110110

111+
CFLAGS += -DNRF_REGULATORS_HAS_POFCON=0
112+
CFLAGS += -DNRF_REGULATORS_HAS_POFCON_VDDH=0
113+
CFLAGS += -DNRF_REGULATORS_HAS_DCDCEN_VDDH=0
114+
111115
# MCU_SUB_VARIANT can be nrf52 (nrf52832), nrf52833, nrf52840
112116
ifeq ($(MCU_SUB_VARIANT),nrf52)
113117
SD_NAME = s132
114118
DFU_DEV_REV = 0xADAF
115119
CFLAGS += -DNRF52 -DNRF52832_XXAA -DS132
120+
CFLAGS += -DIS_NRF52840=0 -DIS_NRF52832=1 -DIS_NRF52833=0 -DIS_NRF52805=0 -DIS_NRF52810=0 -DIS_NRF52811=0 -DIS_NRF52820=0
116121
DFU_APP_DATA_RESERVED=7*4096
117122
else ifeq ($(MCU_SUB_VARIANT),nrf52833)
118123
SD_NAME = s140
119124
DFU_DEV_REV = 52833
120125
CFLAGS += -DNRF52833_XXAA -DS140
126+
CFLAGS += -DIS_NRF52840=0 -DIS_NRF52832=0 -DIS_NRF52833=1 -DIS_NRF52805=0 -DIS_NRF52810=0 -DIS_NRF52811=0 -DIS_NRF52820=0
121127
DFU_APP_DATA_RESERVED=7*4096
122128
else ifeq ($(MCU_SUB_VARIANT),nrf52840)
123129
SD_NAME = s140
124130
DFU_DEV_REV = 52840
125131
CFLAGS += -DNRF52840_XXAA -DS140
132+
CFLAGS += -DIS_NRF52840=1 -DIS_NRF52832=0 -DIS_NRF52833=0 -DIS_NRF52805=0 -DIS_NRF52810=0 -DIS_NRF52811=0 -DIS_NRF52820=0
126133
DFU_APP_DATA_RESERVED=10*4096
127134
else
128135
$(error Sub Variant $(MCU_SUB_VARIANT) is unknown)

lib/nrfx

Submodule nrfx updated 608 files

lib/sdk/components/libraries/timer/app_timer.c

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ STATIC_ASSERT(RTC1_IRQ_PRI == SWI_IRQ_PRI);
6464

6565
#define MAX_RTC_TASKS_DELAY 47 /**< Maximum delay until an RTC task is executed. */
6666

67-
#if (APP_TIMER_CONFIG_SWI_NUMBER == 0)
68-
#define SWI_IRQn SWI0_IRQn
69-
#define SWI_IRQHandler SWI0_IRQHandler
70-
#elif (APP_TIMER_CONFIG_SWI_NUMBER == 1)
71-
#define SWI_IRQn SWI1_IRQn
72-
#define SWI_IRQHandler SWI1_IRQHandler
73-
#else
74-
#error "Unsupported SWI number."
75-
#endif
76-
7767
#define MODULE_INITIALIZED (m_op_queue.size != 0) /**< Macro designating whether the module has been initialized properly. */
7868

7969
/**@brief Timer node type. The nodes will be used form a linked list of running timers. */
@@ -151,6 +141,10 @@ static bool m_rtc1_reset;
151141
static uint8_t m_max_user_op_queue_utilization; /**< Maximum observed timer user operations queue utilization. */
152142
#endif
153143

144+
/**@brief Function for handling changes to the timer list.
145+
*/
146+
static void timer_list_handler(void);
147+
154148
/**@brief Function for initializing the RTC1 counter.
155149
*
156150
* @param[in] prescaler Value of the RTC1 PRESCALER register. Set to 0 for no prescaling.
@@ -198,6 +192,25 @@ static void rtc1_stop(void)
198192
m_rtc1_running = false;
199193
}
200194

195+
/**@brief Function suspends RTC1 timer.
196+
*/
197+
static void rtc1_suspend(void)
198+
{
199+
if(m_rtc1_running == true)
200+
{
201+
NRF_RTC1->TASKS_STOP = 1;
202+
}
203+
}
204+
205+
/**@brief Function resumes RTC1 timer.
206+
*/
207+
static void rtc1_resume(void)
208+
{
209+
if(m_rtc1_running == true)
210+
{
211+
NRF_RTC1->TASKS_START = 1;
212+
}
213+
}
201214

202215
/**@brief Function for returning the current value of the RTC1 counter.
203216
*
@@ -352,14 +365,6 @@ static void timer_timeouts_check_sched(void)
352365
NVIC_SetPendingIRQ(RTC1_IRQn);
353366
}
354367

355-
356-
/**@brief Function for scheduling a timer list update by generating a SWI interrupt.
357-
*/
358-
static void timer_list_handler_sched(void)
359-
{
360-
NVIC_SetPendingIRQ(SWI_IRQn);
361-
}
362-
363368
#if APP_TIMER_CONFIG_USE_SCHEDULER
364369
static void timeout_handler_scheduled_exec(void * p_event_data, uint16_t event_size)
365370
{
@@ -455,7 +460,7 @@ static void timer_timeouts_check(void)
455460
// Queue the ticks expired.
456461
m_ticks_elapsed[m_ticks_elapsed_q_write_ind] = ticks_expired;
457462

458-
timer_list_handler_sched();
463+
timer_list_handler();
459464
}
460465
}
461466

@@ -727,6 +732,8 @@ static void timer_list_handler(void)
727732
bool compare_update = false;
728733
timer_node_t * p_timer_id_head_old;
729734

735+
rtc1_suspend();
736+
730737
#if APP_TIMER_WITH_PROFILER
731738
{
732739
uint8_t size = m_op_queue.size;
@@ -768,6 +775,8 @@ static void timer_list_handler(void)
768775
compare_reg_update(p_timer_id_head_old);
769776
}
770777
m_rtc1_reset = false;
778+
779+
rtc1_resume();
771780
}
772781

773782

@@ -850,7 +859,7 @@ static uint32_t timer_start_op_schedule(timer_node_t * p_node,
850859

851860
if (err_code == NRF_SUCCESS)
852861
{
853-
timer_list_handler_sched();
862+
timer_list_handler();
854863
}
855864

856865
return err_code;
@@ -888,7 +897,7 @@ static uint32_t timer_stop_op_schedule(timer_node_t * p_node,
888897

889898
if (err_code == NRF_SUCCESS)
890899
{
891-
timer_list_handler_sched();
900+
timer_list_handler();
892901
}
893902

894903
return err_code;
@@ -941,10 +950,6 @@ ret_code_t app_timer_init(void)
941950
m_max_user_op_queue_utilization = 0;
942951
#endif
943952

944-
NVIC_ClearPendingIRQ(SWI_IRQn);
945-
NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI);
946-
NVIC_EnableIRQ(SWI_IRQn);
947-
948953
rtc1_init(APP_TIMER_CONFIG_RTC_FREQUENCY);
949954

950955
m_ticks_latest = rtc1_counter_get();

lib/sdk/components/libraries/util/app_util_platform.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ extern "C" {
7979
#define _PRIO_APP_LOW 6
8080
#define _PRIO_APP_LOWEST 7
8181
#define _PRIO_THREAD 15
82+
#elif __CORTEX_M == (33U)
83+
#define _PRIO_SD_HIGH 0
84+
#define _PRIO_SD_MID 1
85+
#define _PRIO_APP_HIGH 2
86+
#define _PRIO_APP_MID 3
87+
#define _PRIO_SD_LOW 4
88+
#define _PRIO_SD_LOWEST 5
89+
#define _PRIO_APP_LOW 6
90+
#define _PRIO_APP_LOWEST 7
91+
#define _PRIO_THREAD 15
8292
#else
8393
#error "No platform defined"
8494
#endif

lib/sdk11/components/drivers_nrf/pstorage/pstorage_raw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
#define SOC_MAX_WRITE_SIZE 1024 /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF51. */
4444
#elif defined(NRF52_SERIES)
4545
#define SOC_MAX_WRITE_SIZE 4096 /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF52. */
46+
#elif defined(NRF5340_XXAA_APPLICATION)
47+
#define SOC_MAX_WRITE_SIZE 4096 /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF53. */
48+
#elif defined(NRF5340_XXAA_NETWORK)
49+
#define SOC_MAX_WRITE_SIZE 2048 /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF53. */
4650
#else
4751
#error No target defined
4852
#endif

lib/sdk11/components/libraries/bootloader_dfu/bootloader.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,12 @@ void bootloader_app_start(void)
377377
{
378378
PRINTF("SoftDevice not exist\r\n");
379379

380-
// App starts right after MBR
380+
// App starts right after MBR (except for networking core)
381+
#if !defined(NRF5340_XXAA_NETWORK)
381382
app_addr = MBR_SIZE;
383+
#else
384+
app_addr = APP_START_ADDRESS;
385+
#endif
382386
sd_mbr_command_t command =
383387
{
384388
.command = SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET,

lib/sdk11/components/libraries/bootloader_dfu/dfu_types.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,18 @@ static inline bool is_sd_existed(void)
6262
#endif
6363
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x000FE000 /**< The field specifies the page location of the mbr params page address. */
6464
#define BOOTLOADER_SETTINGS_ADDRESS 0x000FF000 /**< The field specifies the page location of the bootloader settings address. */
65-
65+
#elif defined(NRF5340_XXAA_APPLICATION)
66+
#ifndef BOOTLOADER_REGION_START
67+
#define BOOTLOADER_REGION_START 0x000EE000
68+
#endif
69+
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x000FE000
70+
#define BOOTLOADER_SETTINGS_ADDRESS 0x000FF000
71+
#elif defined(NRF5340_XXAA_NETWORK)
72+
#ifndef BOOTLOADER_REGION_START
73+
#define BOOTLOADER_REGION_START 0x01000000
74+
#endif
75+
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x0103F000
76+
#define BOOTLOADER_SETTINGS_ADDRESS 0x0103F800
6677
#else
6778
#error No target defined
6879
#endif

0 commit comments

Comments
 (0)