Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Device tree corrupted

Honored Contributor II

Hi all, 


I use a 3.2.0 kernel from Altera git on a nios2, I have no bootloader and an initramfs. the kernel is loaded directly from Flash using altera_nios2/boot_loader_cfi.srec 


The kernel succeed to boot however I have corrupted values in /proc/device-tree. For instance in /proc/device-tree/sopc@0/gpio@0x2000120compatible : 

hexdump -C /proc/device-tree/sopc@0/gpio@0x2000120/compatible 00000000 68 69 73 20 68 65 6c 70 20 6d 65 73 73 61 67 65 |his help message| 00000010 20 61 6e 64 20 65 78 69 74 00 00 | and exit..|  


It is the same for each of my devices in the device-tree. I search for those corrupted values and found that they comes from rootfs.initramfs file generated by uClinux 


I really don't know how to fix this. It is a big problem since I can't even drive a GPIO :(. 


I found some old forums that talk about a similar issue : 

There is no solution and this forum seems dead. 


Does someone had the same issue ?  

And does one find a solution ? 


Best regards
0 Kudos
1 Reply
Honored Contributor II



So after (a long) investigation I think I can explain what happens, but I don't know how to correct since it may come from the kernel sources (I'm not kernel developper). 


If I dump device-tree values before starting any application the device-tree (DT) is not corrupted. 

If I start an application that requires quite a lot of memory (such as net-snmp with V3 and encryption/authentication enabled) the device tree becomes corrupted. 


It seems that applications that requires quite a lot of memory are overwritting DT values. 

So I configure my GPIOs before DT corruption and everything works fine. 


But this is not really a solution. 

So I think that the DT area is not protected from a kernel point of vu, so the memory used by the DT is overwritten when kernel needs more memory. 


I don't know if the issue comes from the kernel itself or from uClinux stuffs. 


Does someone has any idea ? 


Best regards 


PS : the more strange behaviour is that with a 16MB RAM the DT needs more applications running to be corrupted, with a 32MB RAM the DT is corrupted after the first application launched?
0 Kudos