Alex,
I don't know what might be causing the seg fault, but it would not be
due to lack of requested memory size. Memory_contigAlloc() and the
underlying CMEM APIs are able to handle a failed allocation and return
gracefully. One way to confirm this would be to somehow stop the
program at the failing Memory_contigAlloc() (w/ gdb perhaps) and do a
% cat /proc/cmem
to see the state of all CMEM buffers and if there is enough for the
upcoming call.
In order to determine further, it would be helpful to see some trace or
debug output. You can set CE_DEBUG=3 on the command line for max detail
(or set CE_TRACE="*=01234567"). You should see a bunch of output
leading up to your failure. This might not get you the CMEM user API
debug, however, and it won't give any CMEM kernel module debug. For
CMEM user API debug, you might need to do
var cmem = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
cmem.debug = true;
in your app.cfg file, but it's possible, depending on the version of CE,
that just setting the app profile to debug will do the trick. To see
CMEM kernel module debug, you'd need to remake cmemk.ko by issuing
% make debug
in the cmem/src/module directory and insmod'ing the cmemk.ko that
results (and issuing a % dmesg command to dump the debug output).
Having said all that, you could also run under gdb up to the segfault,
and gdb should be able to give you a good idea what was the bad pointer.
Regards,
- Rob
________________________________
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
com] On Behalf Of Alex Tarter
Sent: Friday, April 25, 2008 6:22 AM
To: [email protected]
Subject: Segmentation fault
I'm trying to write my own JPEG encoder program leveraging the
JPEGencoder dsp codec provided in the 'Motion JPEG' demo.
I've built my application and ported it across onto the DVEVM
but when the program reaches the command:
'outbufs.bufs[0] = Memory_contigAlloc(outBufs.bufSizes[0],
Memory_DEFAULTALIGNMENT)' it causes a segmentation fault and the program
exits.
outBufs.bufSizes[0] = 414720 * 3 // 720*576*3
I'm guessing that this is due to the program being unable to
allocate that amount of memory. I'm using the cmem.ko & dsplinkk.ko
modules that came with the motion jpeg demo and the same loadmodules
script which allocates the pools:
Pools = 1x3145728, 3x829440, 1x61440, 1x10240
I built the program using the original dvevm tools (dvevm_1_10)
as I couldn't make the 1.2 version work (compiling would cause it to
give the error message
'/opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/armv5tl-montavista-lin
uxeabi/bin/arm_v5t_le-gcc cannot be found').
Does anyone know how I stop my program giving me a 'segmentation
fault'??
Thanks,
Alex
Alex Tarter
KTP Associate
Ultra Electronics
Sonar & Communication Systems
Tel: +44 (0)20 8813 4527
Mobile: +44 (0)772 018 2267
www.ultra-electronics.com
________________________________
This e-mail from Ultra Electronics Limited and any attachments
to it are confidential to the intended recipient and may also be
privileged. If you have received it in error please notify the sender
and delete it from your system. If you are not the intended recipient
you must not copy it or use it for any purpose nor disclose or
distribute its contents to any other person. All communications may be
subject to interception or monitoring for operational and/or security
purposes. Please rely on your own virus checking as the sender cannot
accept any liability for any damage arising from any bug or virus
infection. Ultra Electronics Limited is a company registered in England
and Wales, registration number 2830644. The address of its registered
office is 417 Bridport Road, Greenford, Middlesex, UB6 8UA.
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source