cancel
Showing results for 
Search instead for 
Did you mean: 

STM32mp157-dk2 - wathcdog and device tree

RafalBil
Associate II

Hi

I have recently been working on the board model mentioned in the title. At the moment I have a problem with two things:

1. when trying to debug the kernel drivers, the kernel is inactive for a period of time which causes the watchdog to run. This behavior makes it impossible to debug the drivers. Is there any convenient solution to disable the watchdog?

At this point I have disabled support for watchdog in both the uboot and kernel, but this has caused the board to reset itself no matter what I do (there is information on the wiki about the possibility of disabling it from the build root level). Looking through the information available on the Internet, I found out that you could directly modify the memory, but this option does not suit me. Another piece of advice is in the course from bootlin:

 

```
However, it turns out that this pre-defined configuration enables the STM32 watchdog, and since our Linux user-space does not have a watchdog daemon to tick the watchdog regularly, it would reset constantly. Using a small additional snippet of U-Boot configuration, stored in the file board/stmicroelectronics/stm32mp157-dk/uboot-fragment.config, we disable the watchdog.
```

 

but here I can't find the file uboot-fragment.config. Is there any example of the use of this file? The 3rd option supposedly is to change the device tree file and hence my 2nd question

2 I understand the typical compilation of the dtb file. However, the files from this board in the code have .h files for example this one https://github.com/bootlin/buildroot-external-st/blob/st/2023.02.10/board/stmicroelectronics/stm32mp1/linux-dts/stm32mp157c-dk2-mx.dts.

I know that you can generate files of this type using the tools provided. However, I am still learning and would like to do it currently at the make level. I understand that in this case the file needs to be reprocessed with a cpp compiler. However, my make is not working and I am not sure why. My makefile looks like this

 

```
SRCARCH = arm

DTC = dtc
DTCFLAGS = -b 0
dtc_cpp_flags = -x assembler-with-cpp -nostdinc ``.
-I arch \n-.
-undef -D__DTS__

DTCHINCLUDES = - <path to h files>.

DTSIINC = <path to dtsi> files

%.dtb: %.dts
cpp -nostdinc -I include -I arch -I ${DTSIINC} I- ${DTCHINCLUDES} -undef -x assembler-with-cpp stm32mp157f-dk2-mx.dts stm32mp157f-dk2-mx.dts.preprocessed

all: stm32mp157f-dk2-mx.dtb

```

 

Is there any example makefile for dtc files for this board? If not, could you please direct me how to compile the file using the makefile? And what to change to disable watchdog support

Thanks in advance for your help
Rafal

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@RafalBil ,
You do not have to touch these kind of files, only the Device trees itself :

For example if I take OP-TEE stm32mp15xx-dkx.dtsi I have :

&iwdg1 {
	timeout-sec = <32>;
	status = "okay";
};

You need to turn the status to "disabled"
Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Erwan SZYMANSKI
ST Employee

Hello @RafalBil ,
The watchdog is present in every boot stage. You told about U-boot and the Linux kernel, but you also have to disable it in the device trees of TF-A and OP-TEE. 

Kind regards,
Erwan

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Yes, so that's where my question comes from as to how this can be done from within DTB. I've already managed to compile the tree, however, I'm not sure which option I should change to disable the watchdog correctly.

BTW maybe someone will find it useful a workable makefile for compiling this particular tree looks like this (only the includ paths need to be changed). And I haven't tested the operation yet, but an output file is produced

 

```

dtc_cpp_flags = -nostdinc -undef -x assembler-with-cpp -undef

DTCHINCLUDES = -I ./ # include folder for h files

DTSIINC = -I ./DtsiFiles # include DTSi files folder

compileDTB:

cpp ${dtc_cpp_flags} ${DTSIINC} ${DTCHINCLUDES} ./stm32mp157f-dk2-mx.dts stm32mp157-dk2-pre.dts

dtc -O dtb -o stm32mp157.dtb stm32mp157-dk2-pre.dts

all: compileDTB

```

@RafalBil ,
You do not have to touch these kind of files, only the Device trees itself :

For example if I take OP-TEE stm32mp15xx-dkx.dtsi I have :

&iwdg1 {
	timeout-sec = <32>;
	status = "okay";
};

You need to turn the status to "disabled"
Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks, I think I understand. I also know theoretically that changing the dtsi file is enough, but as a learning experience I want to do it at least once from scratch. I was probably confused by the fact that there are some changes in the dts files provided by bootlin and there if I'm not mistaken watchdog is defined as "arm_wdt). Thanks again, Rafal