Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move kernel/soc/arch/drivers to new logger #10029

Merged
merged 43 commits into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a632efc
kernel: move to new logger
nashif Sep 17, 2018
a8cbcc4
arch: setup logging using new logger
nashif Sep 17, 2018
1b0bcbd
soc: logging: move soc tree to new logger
nashif Sep 17, 2018
5212e46
kernel: move malloc handling to new logger
nashif Sep 17, 2018
7cf7e87
drivers: entropy: remove unused logger kconfig
nashif Sep 17, 2018
54fc929
drivers: adc: move to new logger
nashif Sep 17, 2018
f63787a
drivers: audio: move to new logger
nashif Sep 17, 2018
7c8b432
drivers: can: move to new logger
nashif Sep 17, 2018
da9c484
drivers: clock_control: move to new logger
nashif Sep 17, 2018
0197b44
drivers: crypto: move to new logger
nashif Sep 17, 2018
7607bb4
drivers: i2c: move to new logger
nashif Sep 17, 2018
77c4d19
drivers: dma: move to new logger
nashif Sep 17, 2018
b7f9a4c
drivers: watchdog: Migrate to new logging subsys
Olivier-ProGlove Aug 9, 2018
4caf7cc
samples: fix prj.conf to use new logger
nashif Sep 22, 2018
c66918b
samples: crypto: move to new logger
nashif Sep 22, 2018
6bd9e3e
samples: move crypto sample to new logger
nashif Sep 22, 2018
20df920
driver: pwm: use new logger
nashif Sep 23, 2018
92d2911
samples: led_lp5562: move to new logger
nashif Sep 23, 2018
38c238b
samples: led_lp3943: move to new logger
nashif Sep 23, 2018
1361205
samples: led_ws2812: move to new logger
nashif Sep 23, 2018
6137558
samples: led_pca9633: move to new logger
nashif Sep 23, 2018
512e33d
samples: led_lpd8806: move to new logger
nashif Sep 23, 2018
80c424a
samples: flash_shell: move to new logger
nashif Sep 23, 2018
3a15ca2
samples: led: fix default log level kconfig
nashif Oct 8, 2018
7bff54c
driver: spi: use new logger
nashif Sep 23, 2018
ec2a9c8
tests: crypto: use printk instead of logging
nashif Sep 23, 2018
e9c5ed5
arch: nxp_mpu: fix types in log macro
nashif Sep 23, 2018
141bdf8
drivers: spi_dw: remove debug message
nashif Sep 30, 2018
859c7b9
drivers: display: define DISPLAY log level
nashif Oct 4, 2018
6907794
samples: display: set log level correctly
nashif Oct 5, 2018
1093bd5
tests: logging: disable default log modules
nashif Oct 4, 2018
483498c
subsys: nvs: move to new logger
nashif Oct 5, 2018
b3a0f25
nvs: fix style
nashif Oct 5, 2018
ecc0040
drivers: gpio: Migrate to new logging subsys
Olivier-ProGlove Aug 14, 2018
f57c2fc
gpio_sch: fix log message
nashif Oct 8, 2018
f2d3b37
gpio: log: rename level variable
nashif Oct 8, 2018
0d66664
subsys: dfu: Migrate to new logging subsys
Olivier-ProGlove Aug 14, 2018
38eea4a
dfu: log: rename level variable
nashif Oct 8, 2018
8965678
console: move to new logger
nashif Oct 8, 2018
26ff99a
telnet_console: fix syntax
nashif Oct 8, 2018
eee86cf
websocket_console: fix syntax
nashif Oct 8, 2018
99935e9
tests: crypto: use CONFIG_LOG
nashif Oct 8, 2018
6c2ac92
ztest: remove unused include of sys_log.h
nashif Oct 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ endchoice

menu "General Architecture Options"

module = ARCH
module-str = arch
source "subsys/logging/Kconfig.template.log_config"

module = MPU
module-str = mpu
source "subsys/logging/Kconfig.template.log_config"

config HW_STACK_PROTECTION
bool "Hardware Stack Protection"
depends on ARCH_HAS_STACK_PROTECTION
Expand Down
9 changes: 6 additions & 3 deletions arch/arc/core/mpu/arc_core_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
#include <kernel.h>
#include <soc.h>
#include <arch/arc/v2/mpu/arc_core_mpu.h>
#include <logging/sys_log.h>

#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_REGISTER(mpu);

/*
* @brief Configure MPU for the thread
Expand Down Expand Up @@ -81,7 +84,7 @@ void configure_mpu_stack_guard(struct k_thread *thread)
*/
void configure_mpu_user_context(struct k_thread *thread)
{
SYS_LOG_DBG("configure user thread %p's context", thread);
LOG_DBG("configure user thread %p's context", thread);
arc_core_mpu_configure_user_context(thread);
}

Expand All @@ -96,7 +99,7 @@ void configure_mpu_user_context(struct k_thread *thread)
*/
void configure_mpu_mem_domain(struct k_thread *thread)
{
SYS_LOG_DBG("configure thread %p's domain", thread);
LOG_DBG("configure thread %p's domain", thread);
arc_core_mpu_configure_mem_domain(thread->mem_domain_info.mem_domain);
}

Expand Down
22 changes: 12 additions & 10 deletions arch/arc/core/mpu/arc_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#include <arch/arc/v2/mpu/arc_mpu.h>
#include <arch/arc/v2/mpu/arc_core_mpu.h>
#include <linker/linker-defs.h>
#include <logging/sys_log.h>

#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_DECLARE(mpu);

#define AUX_MPU_RDB_VALID_MASK (0x1)
#define AUX_MPU_EN_ENABLE (0x40000000)
Expand Down Expand Up @@ -330,7 +332,7 @@ void arc_core_mpu_configure(u8_t type, u32_t base, u32_t size)
u32_t region_index = _get_region_index_by_type(type);
u32_t region_attr = _get_region_attr_by_type(type);

SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size);
LOG_DBG("Region info: 0x%x 0x%x", base, size);

if (region_attr == 0) {
return;
Expand Down Expand Up @@ -488,11 +490,11 @@ void arc_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain)
struct k_mem_partition *pparts;

if (mem_domain) {
SYS_LOG_DBG("configure domain: %p", mem_domain);
LOG_DBG("configure domain: %p", mem_domain);
num_partitions = mem_domain->num_partitions;
pparts = mem_domain->partitions;
} else {
SYS_LOG_DBG("disable domain partition regions");
LOG_DBG("disable domain partition regions");
num_partitions = 0;
pparts = NULL;
}
Expand All @@ -511,13 +513,13 @@ void arc_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain)
for (; region_index < num_regions; region_index++) {
#endif
if (num_partitions && pparts->size) {
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",
LOG_DBG("set region 0x%x 0x%x 0x%x",
region_index, pparts->start, pparts->size);
_region_init(region_index, pparts->start, pparts->size,
pparts->attr);
num_partitions--;
} else {
SYS_LOG_DBG("disable region 0x%x", region_index);
LOG_DBG("disable region 0x%x", region_index);
/* Disable region */
_region_init(region_index, 0, 0, 0);
}
Expand All @@ -537,15 +539,15 @@ void arc_core_mpu_configure_mem_partition(u32_t part_index,
u32_t region_index =
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);

SYS_LOG_DBG("configure partition index: %u", part_index);
LOG_DBG("configure partition index: %u", part_index);

if (part) {
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",
LOG_DBG("set region 0x%x 0x%x 0x%x",
region_index + part_index, part->start, part->size);
_region_init(region_index, part->start, part->size,
part->attr);
} else {
SYS_LOG_DBG("disable region 0x%x", region_index + part_index);
LOG_DBG("disable region 0x%x", region_index + part_index);
/* Disable region */
_region_init(region_index + part_index, 0, 0, 0);
}
Expand All @@ -561,7 +563,7 @@ void arc_core_mpu_mem_partition_remove(u32_t part_index)
u32_t region_index =
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);

SYS_LOG_DBG("disable region 0x%x", region_index + part_index);
LOG_DBG("disable region 0x%x", region_index + part_index);
/* Disable region */
_region_init(region_index + part_index, 0, 0, 0);
}
Expand Down
9 changes: 6 additions & 3 deletions arch/arm/core/cortex_m/mpu/arm_core_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
#include <soc.h>
#include <arch/arm/cortex_m/cmsis.h>
#include <arch/arm/cortex_m/mpu/arm_core_mpu.h>
#include <logging/sys_log.h>

#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_REGISTER(mpu);

#if defined(CONFIG_MPU_STACK_GUARD)
/*
Expand Down Expand Up @@ -50,7 +53,7 @@ void configure_mpu_stack_guard(struct k_thread *thread)
*/
void configure_mpu_user_context(struct k_thread *thread)
{
SYS_LOG_DBG("configure user thread %p's context", thread);
LOG_DBG("configure user thread %p's context", thread);
arm_core_mpu_disable();
arm_core_mpu_configure_user_context(thread);
arm_core_mpu_enable();
Expand All @@ -66,7 +69,7 @@ void configure_mpu_user_context(struct k_thread *thread)
*/
void configure_mpu_mem_domain(struct k_thread *thread)
{
SYS_LOG_DBG("configure thread %p's domain", thread);
LOG_DBG("configure thread %p's domain", thread);
arm_core_mpu_disable();
arm_core_mpu_configure_mem_domain(thread->mem_domain_info.mem_domain);
arm_core_mpu_enable();
Expand Down
21 changes: 12 additions & 9 deletions arch/arm/core/cortex_m/mpu/arm_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
#include <arch/arm/cortex_m/cmsis.h>
#include <arch/arm/cortex_m/mpu/arm_mpu.h>
#include <arch/arm/cortex_m/mpu/arm_core_mpu.h>
#include <logging/sys_log.h>
#include <linker/linker-defs.h>

#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_DECLARE(mpu);

#if defined(CONFIG_CPU_CORTEX_M0PLUS) || \
defined(CONFIG_CPU_CORTEX_M3) || \
defined(CONFIG_CPU_CORTEX_M4) || \
Expand Down Expand Up @@ -149,7 +152,7 @@ static inline void _disable_region(u32_t r_index)
"Index 0x%x out-of-bound (supported regions: 0x%x)\n",
r_index,
_get_num_regions());
SYS_LOG_DBG("disable region 0x%x", r_index);
LOG_DBG("disable region 0x%x", r_index);
/* Disable region */
ARM_MPU_ClrRegion(r_index);
}
Expand All @@ -165,7 +168,7 @@ void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size)
{
struct arm_mpu_region region_conf;

SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size);
LOG_DBG("Region info: 0x%x 0x%x", base, size);
u32_t region_index = _get_region_index_by_type(type);

if (_get_region_attr_by_type(&region_conf.attr, type, base, size)) {
Expand Down Expand Up @@ -208,18 +211,18 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain)
struct arm_mpu_region region_conf;

if (mem_domain) {
SYS_LOG_DBG("configure domain: %p", mem_domain);
LOG_DBG("configure domain: %p", mem_domain);
num_partitions = mem_domain->num_partitions;
pparts = mem_domain->partitions;
} else {
SYS_LOG_DBG("disable domain partition regions");
LOG_DBG("disable domain partition regions");
num_partitions = 0;
pparts = NULL;
}

for (; region_index < _get_num_regions(); region_index++) {
if (num_partitions && pparts->size) {
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",
LOG_DBG("set region 0x%x 0x%x 0x%x",
region_index, pparts->start, pparts->size);
region_conf.base = pparts->start;
_get_ram_region_attr_by_conf(&region_conf.attr,
Expand All @@ -246,11 +249,11 @@ void arm_core_mpu_configure_mem_partition(u32_t part_index,
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
struct arm_mpu_region region_conf;

SYS_LOG_DBG("configure partition index: %u", part_index);
LOG_DBG("configure partition index: %u", part_index);

if (part &&
(region_index + part_index < _get_num_regions())) {
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",
LOG_DBG("set region 0x%x 0x%x 0x%x",
region_index + part_index, part->start, part->size);
_get_ram_region_attr_by_conf(&region_conf.attr,
part->attr, part->start, part->size);
Expand Down Expand Up @@ -327,7 +330,7 @@ static int arm_mpu_init(struct device *arg)
return -1;
}

SYS_LOG_DBG("total region count: %d", _get_num_regions());
LOG_DBG("total region count: %d", _get_num_regions());

arm_core_mpu_disable();

Expand Down
6 changes: 5 additions & 1 deletion arch/arm/core/cortex_m/mpu/arm_mpu_v7_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#ifndef ZEPHYR_ARCH_ARM_CORE_CORTEX_M_MPU_ARM_MPU_V7_INTERNAL_H_
#define ZEPHYR_ARCH_ARM_CORE_CORTEX_M_MPU_ARM_MPU_V7_INTERNAL_H_


#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>

/* Global MPU configuration at system initialization. */
static void _mpu_init(void)
{
Expand All @@ -27,7 +31,7 @@ static void _region_init(u32_t index, struct arm_mpu_region *region_conf)
MPU->RBAR = (region_conf->base & MPU_RBAR_ADDR_Msk)
| MPU_RBAR_VALID_Msk | index;
MPU->RASR = region_conf->attr.rasr | MPU_RASR_ENABLE_Msk;
SYS_LOG_DBG("[%d] 0x%08x 0x%08x",
LOG_DBG("[%d] 0x%08x 0x%08x",
index, region_conf->base, region_conf->attr.rasr);
}

Expand Down
4 changes: 3 additions & 1 deletion arch/arm/core/cortex_m/mpu/arm_mpu_v8_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#define ZEPHYR_ARCH_ARM_CORE_CORTEX_M_MPU_ARM_MPU_V8_INTERNAL_H_

#include <cmse.h>
#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>

/* Global MPU configuration at system initialization. */
static void _mpu_init(void)
Expand Down Expand Up @@ -49,7 +51,7 @@ static void _region_init(u32_t index, struct arm_mpu_region *region_conf)
| MPU_RLAR_EN_Msk
);

SYS_LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x",
LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x",
index, region_conf->base, region_conf->attr.rbar,
region_conf->attr.mair_idx, region_conf->attr.r_limit);
}
Expand Down
37 changes: 20 additions & 17 deletions arch/arm/core/cortex_m/mpu/nxp_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
#include <soc.h>
#include <arch/arm/cortex_m/cmsis.h>
#include <arch/arm/cortex_m/mpu/nxp_mpu.h>
#include <logging/sys_log.h>
#include <misc/__assert.h>
#include <linker/linker-defs.h>

#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_DECLARE(mpu);

/* NXP MPU Enabled state */
static u8_t nxp_mpu_enabled;

Expand Down Expand Up @@ -92,11 +95,11 @@ static void _region_init(u32_t index, u32_t region_base,
SYSMPU->WORD[index][3] = SYSMPU_WORD_VLD_MASK;
}

SYS_LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x", index,
SYSMPU->WORD[index][0],
SYSMPU->WORD[index][1],
SYSMPU->WORD[index][2],
SYSMPU->WORD[index][3]);
LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x", index,
(u32_t)SYSMPU->WORD[index][0],
(u32_t)SYSMPU->WORD[index][1],
(u32_t)SYSMPU->WORD[index][2],
(u32_t)SYSMPU->WORD[index][3]);
}

/**
Expand Down Expand Up @@ -225,7 +228,7 @@ void arm_core_mpu_disable(void)
*/
void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size)
{
SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size);
LOG_DBG("Region info: 0x%x 0x%x", base, size);
u32_t region_index = _get_region_index_by_type(type);
u32_t region_attr = _get_region_attr_by_type(type);

Expand Down Expand Up @@ -265,11 +268,11 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain)
struct k_mem_partition *pparts;

if (mem_domain) {
SYS_LOG_DBG("configure domain: %p", mem_domain);
LOG_DBG("configure domain: %p", mem_domain);
num_partitions = mem_domain->num_partitions;
pparts = mem_domain->partitions;
} else {
SYS_LOG_DBG("disable domain partition regions");
LOG_DBG("disable domain partition regions");
num_partitions = 0;
pparts = NULL;
}
Expand All @@ -280,15 +283,15 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain)
*/
for (; region_index < _get_num_usable_regions(); region_index++) {
if (num_partitions && pparts->size) {
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",
LOG_DBG("set region 0x%x 0x%x 0x%x",
region_index, pparts->start, pparts->size);
region_attr = pparts->attr;
_region_init(region_index, pparts->start,
ENDADDR_ROUND(pparts->start+pparts->size),
region_attr);
num_partitions--;
} else {
SYS_LOG_DBG("disable region 0x%x", region_index);
LOG_DBG("disable region 0x%x", region_index);
/* Disable region */
SYSMPU->WORD[region_index][0] = 0;
SYSMPU->WORD[region_index][1] = 0;
Expand All @@ -312,17 +315,17 @@ void arm_core_mpu_configure_mem_partition(u32_t part_index,
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
u32_t region_attr;

SYS_LOG_DBG("configure partition index: %u", part_index);
LOG_DBG("configure partition index: %u", part_index);

if (part) {
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",
LOG_DBG("set region 0x%x 0x%x 0x%x",
region_index + part_index, part->start, part->size);
region_attr = part->attr;
_region_init(region_index + part_index, part->start,
ENDADDR_ROUND(part->start + part->size),
region_attr);
} else {
SYS_LOG_DBG("disable region 0x%x", region_index);
LOG_DBG("disable region 0x%x", region_index);
/* Disable region */
SYSMPU->WORD[region_index + part_index][0] = 0;
SYSMPU->WORD[region_index + part_index][1] = 0;
Expand All @@ -341,7 +344,7 @@ void arm_core_mpu_mem_partition_remove(u32_t part_index)
u32_t region_index =
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);

SYS_LOG_DBG("disable region 0x%x", region_index);
LOG_DBG("disable region 0x%x", region_index);
/* Disable region */
SYSMPU->WORD[region_index + part_index][0] = 0;
SYSMPU->WORD[region_index + part_index][1] = 0;
Expand Down Expand Up @@ -424,7 +427,7 @@ static void _nxp_mpu_config(void)

__ASSERT(mpu_config.num_regions <= _get_num_regions(),
"too many static MPU regions defined");
SYS_LOG_DBG("total region count: %d", _get_num_regions());
LOG_DBG("total region count: %d", _get_num_regions());

/* Disable MPU */
SYSMPU->CESR &= ~SYSMPU_CESR_VLD_MASK;
Expand Down Expand Up @@ -491,7 +494,7 @@ static int nxp_mpu_init(struct device *arg)
return 0;
}

#if defined(CONFIG_SYS_LOG)
#if defined(CONFIG_LOG)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure is this is still valid.
@nordic-krch: As far as I remember logger could accept messages very early, before kernel initialization. Is that still true?

/* To have logging the driver needs to be initialized later */
SYS_INIT(nxp_mpu_init, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
Expand Down
Loading