This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EVMDM365 Segmentation Fault while accessing System Module register



I have copied the source code of one of the sample programs for CCS over to my Linux setup and have compiled it using Montavista arm_v5t_le-gcc.

It compiles without any errors, but if I run it using NFS I get a Segmentation Fault when it executes a read/write to PINMUX3.

The define code is:

#define SYSTEM_BASE   0x01C40000

#define PINMUX3             *( volatile Uint32* )( SYSTEM_BASE + 0x0C )

The line that throws the error is:

PINMUX3 &= ~0x00600000;

I have eliminated any other calls so this is the only line that gets executed.

I have run simple 'hello world' programs with no errors.

My environment:

printenv
bootdelay=4
baudrate=115200
ethaddr=00:0e:99:02:cd:d7
rootpath=/home/sam/workdir/filesys
nfshost=192.168.114.141
serverip=192.168.114.141
bootfile="uImage"
bootcmd=nboot 0x80700000 0 0x400000;bootm
ipaddr=192.168.114.101
stdin=serial
stdout=serial
stderr=serial
ver=U-Boot 1.3.4 (Mar  2 2009 - 11:50:39)
bootargs=console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=192.168.114.141:/home/sam/workdir/filesys,nolock mem=76M video=davincifb:viid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4

Environment size: 544/262140 bytes
DM365 EVM :>

It would seem to be a memory configuration issue.  But where?

 

Thanks,

Sam V

 

  • Follow up:

     

    if I make the register address a Uint32 instead of a *( volatile Uint32* ) I don't get the error ???

    I don't know if that was a fix or not.

    Sam V.

     

  • Hi Sam,

    Are you reading or writing this register from kernel space or user space? I assume you are aware that you have to do an ioremap to get a virtual address for this physical address and then access it using the virtual address from user space.

    As such the access to that register works. You can refer to board-dm365-evm.c file in kernel source tree, file where we access the PINMUX registers.

    Regards,

    Anshuman

    PS: Plase mark this post as verified if you think this has answered your question. Thanks.

  • Thanks Anshuman.

    I am not familiar with that process.

    I have tried to add the line 'void __iomem *pinmux3 = (void __iomem*) IO_ADDRESS(0x01C4000C);'

    But I get an error.  I don't know what header file is needed for that method.

     

    Sam

     

  • I've gone back to square 1 reset and checked my eclipse properties and now it is compiling and running on the target without error.

    I do wish I knew what fixed it.

    Thanks for your help.

    Sam

     

  • Hi Sam,

    sam virgillo said:

    I have tried to add the line 'void __iomem *pinmux3 = (void __iomem*) IO_ADDRESS(0x01C4000C);'

    Your above usage is correct, assuming you are calling this in kernel code. I believe you would be doing that.

    Regards,

    Anshuman

  • I've scoured the internet trying to figure out how to 'call it in kernel code' with no luck.

    So if you would please guide the lost and tell me how I go about calling this in the kernel.

    This is very frustrating.

     

    Thanks,

    sam

     

  • Hi Sam,

    Where are you exactly calling your code to access PINMUX3 register? Can you share your code? As i suggested earlier you can refer to board-dm365-evm.c file in <LSP directory>/arch/arm/mach-davinci/

    If you want to change the register from user space, you need to write a kernel module with an IOCTL that goes and modifies the required PINMUX3 register. Your user space application code has to call this IOCTL.

    For example on kernel modules and accessing the registers, you can refer to dm365mmap, edmak, cmemk or irqk modules in DVSDK codebase.

    Regards,

    Anshuman