On Thu, Apr 2, 2020 at 2:46 AM Salgado, Marisol <[email protected]> wrote:
> SDK: ti-processor-sdk-linux-am335x-evm-05.03.00.07.

Hi Marisol!  Nice to see a familiar name from my days at Newark.  I'm
part of the BeagleBoard.org Foundation so happy to help where I can.

Based on am335x in the Subject, are you working with a BeagleBone Black?

> I want to have more debug ouputs in the console window during the Linux 
> kernel booting so that I can trace for example MMC driver loading process.
>
> Added some printk() into the kernel, for example printk("this function is 
> called \n"). After successful compiling and loading the kernel unfortunately 
> I can't see the
> expected output message "this function is called" in the console window.

It is generally easier to use the "pr_" helper functions:
https://elinux.org/Debugging_by_printing

pr_err() uses KERN_ERR level should always print regardless of the
printk log level.  KERN_ERR is not a good practice for debug output,
but it does eliminate the chance that the log level is filtering out
your print statements.

Try adding this:
pr_err("DEBUG: start name_of_function()");

If you don't see that in dmesg, then it is likely that the function
you put that in is never actually called.

> I also tried
>
>      echo 8 > /proc/sys/kernel/printk
>
>      dmesg
>
> after login but the same results.
>
> Is there any configuration missing in .config file?

level 8 should be sufficient but it is easier if you just set the
level in the .config before you compile your kernel.

CONFIG_PRINTK_TIME=y
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=7
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7

You probably also want to make sure dynamic debugging is enabled:
CONFIG_DYNAMIC_DEBUG=y

Dynamic debugging is a neat feature where you can chose to see more
debug information for a particular source code file:
https://linux-kernel-labs.github.io/refs/heads/master/labs/kernel_modules.html?highlight=config_dynamic_debug#dynamic-debugging

Sometimes you don't even need to add in your own debug print
statements, you just need to enable the dynamic debug output that is
already built-in to a driver or subsystem.

> I also see brcmf_dbg() in kernel files, how can I activate it?

Are you trying to debug a Broadcom wifi driver?

Taking a look at Elixir to search the kernel code:
https://elixir.bootlin.com/linux/latest/ident/brcmf_dbg

It looks like CONFIG_BRCM_TRACING will enable debug output:
https://elixir.bootlin.com/linux/latest/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h#L63

Try setting that in your .config:
https://cateee.net/lkddb/web-lkddb/BRCM_TRACING.html

While it is technically to enable function tracing for the driver, it
looks like it will cause brcmf_dbg() to be defined.

Now the individual invocations of brcmf_dbg() will have a log level
associated with them.  It appears that level can be set as kernel
module parameter:
https://elixir.bootlin.com/linux/latest/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c#L42

This forum post has more information:
https://forum.openwrt.org/t/getting-output-of-brcmf-dbg/31094/4

It indicates this can be set while the module is loaded via:
echo 6 > /sys/module/brcmfmac/parameters/debug

Let me me now how it goes.

Thanks,
Drew

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAEf4M_BhJHRyc9xwVC2GFsdmRn0pg0k%3DABc37h2v14EOe_X%2BGg%40mail.gmail.com.

Reply via email to