Xmodem transfer - issue

classic Classic list List threaded Threaded
27 messages Options
12
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue

On Sat, Jun 30, 2012 at 6:04 PM, pito <[hidden email]> wrote:
>> That also looks right. The problem is somewhere
>> else, but I don't know
>> where. More debugging is needed ...
>
> enclosed find the picture from life(65,50) where you may see the
> memory used..
>
> 1. does the realloc() know where to allocate?? (in SRAM or in CCM ?)
> - first issue

The allocator should take care of this automatically, yes
(src/newlib/stubs.c:elua_sbrk). However, this was never fully tested
AFAIK.

> 2. it hangs when returning via that outofmem return... - second
> issue

I don't understand ... does it hang, or does it return? Or both? Try
adding some printfs (maybe also near the "realloc" call) to pinpoint
the exact circumstances of this problem.

Best,
Bogdan

> 3. when the transfered file size is small (ie 40k) it works fine
> (because there is none issue N.1 and none issue N.2)..
> p.
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Pito Pito
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue

> I don't understand ... does it hang, or does it
> return? Or both? Try
> adding some printfs (maybe also near the "realloc"
> call) to pinpoint
> the exact circumstances of this problem.

1. I've sent you 2 pictures how it ends - simply stops as you may
see on those pictures.
2. Then I can press Cancel on the upload window and the window
closes.
3. Then I can press Enter within the eLua session and it returns to
eLua prompt:

eLua# recv /mmc/ffff
Waiting for file ... CCC                               <<<<< here I
press ENTER
eLua#

p.

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Pito Pito
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue

I've did following (in shell.c):

printf( "Waiting for file ... " );
if( ( actsize = xmodem_receive( &shell_prog ) ) < 0 )
{

printf( "RETURNING FROM OUTOFMEM #1\n" );

free( shell_prog );

printf( "RETURNING FROM OUTOFMEM #2\n" );

shell_prog = NULL;

printf( "RETURNING FROM OUTOFMEM #3\n" );

if( actsize == XMODEM_ERROR_OUTOFMEM )
printf( "file too big\n" );
else
printf( "XMODEM error\n" );
return;
}

and it finishes as I described before - it stops, when entering
Enter it returns to eLua, I cannot see the messages:

eLua v0.8  Copyright (C) 2007-2011 www.eluaproject.net
eLua# recv /mmc/kkkkk
Waiting for file ... CCC  <<<<here I pressed Enter
eLua#

p.

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Pito Pito
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue

and finally:

if( ( p = realloc( *dest, limit ) ) == NULL )
{

printf("RETURN FROM OUTOFMEM\n");

// Not enough memory, force cancel and return
xmodem_flush( XMODEM_FLUSH_AND_XM_CAN );
return XMODEM_ERROR_OUTOFMEM;
}

and none messege seen..

eLua# recv /mmc/yyyy
Waiting for file ... CCC
eLua#

It is up to you now :) !
p.

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue

On Sat, Jun 30, 2012 at 7:10 PM, pito <[hidden email]> wrote:

> and finally:
>
> if( ( p = realloc( *dest, limit ) ) == NULL )
> {
>
> printf("RETURN FROM OUTOFMEM\n");
>
> // Not enough memory, force cancel and return
> xmodem_flush( XMODEM_FLUSH_AND_XM_CAN );
> return XMODEM_ERROR_OUTOFMEM;
> }
>
> and none messege seen..
>
> eLua# recv /mmc/yyyy
> Waiting for file ... CCC
> eLua#
>
> It is up to you now :) !
> p.

Thanks. What would life be without some weirdness ... :)

Best,
Bogdan

>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Marcelo Politzer Marcelo Politzer
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue


2012/6/30 Bogdan Marinescu <[hidden email]>
On Sat, Jun 30, 2012 at 7:10 PM, pito <[hidden email]> wrote:
> and finally:
>
> if( ( p = realloc( *dest, limit ) ) == NULL )
> {
>
> printf("RETURN FROM OUTOFMEM\n");
>
> // Not enough memory, force cancel and return
> xmodem_flush( XMODEM_FLUSH_AND_XM_CAN );
> return XMODEM_ERROR_OUTOFMEM;
> }
>
> and none messege seen..
>
> eLua# recv /mmc/yyyy
> Waiting for file ... CCC
> eLua#
>
> It is up to you now :) !
> p.

Thanks. What would life be without some weirdness ... :)

Best,
Bogdan

>
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev

Also very much confused about this but a thought came to mind...

Are you sure the problem isn't the SD card?, something like a
fat16 fs. could it be formatted just in case?

Best of luck,
Marcelo


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Pito Pito
Reply | Threaded
Open this post in threaded view
|

Re: Xmodem transfer - issue

> Are you sure the problem isn't the SD card?,
> something like a
> fat16 fs. could it be formatted just in case?
>
> Best of luck,
> Marcelo
>
I do not think it is the sdcard issue as I did a lot of recv and cp
with it - see:
eLua# ls

/rom
hanoi.lua                      7963 bytes
lifebig.lua                    3432 bytes

Total on /rom: 11395 bytes

/mmc
hanoi.lua                      7954 bytes
lifebig.lua                    3431 bytes
hanoi1.lua                     7963 bytes
hanoi2.lua                     7963 bytes
lorem1.txt                     16279 bytes
lorem2.txt                     16279 bytes
lorem3.txt                     16279 bytes
lorem4.txt                     16279 bytes
lorem5.txt                     16279 bytes
lorem6.txt                     16279 bytes
lorem7.txt                     16279 bytes
lorem8.txt                     16279 bytes
lorem9.txt                     16279 bytes
lorem10.txt                    16279 bytes
lorem64                        65130 bytes
lorem96                        74675 bytes
jjjjj                          21570 bytes
picture                        24125 bytes

Total on /mmc: 375601 bytes

eLua#

You may see the 75k file transfered with xmodem as well. I think the
C malloc() decides once to allocate the xmodem buffer in SRAM,
sometimes in the CCM (therefore the 64k limit). Currently the limit
for realloc() is 64k (so it seems it works with CCM block now),
moreover, it crashes at realloc() somehow, so it does not stop the
xmodem upload in a clean manner (when the realloc cannot allocate
enough ram) and it does not print the xmodem' error message "..out
of ram".
Of course the current xmodem implementation shall be changed to the
one with a small xmodem buffer which will be appended to the file
until all data received (unlimited amount of bytes  to be
transfered). I think the stuff with malloc and realloc cannot work
properly within eLua environment and segmented ram properly..
p.

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
12