WOFS question

classic Classic list List threaded Threaded
5 messages Options
Roger Lin Roger Lin
Reply | Threaded
Open this post in threaded view
|

WOFS question

HI,

I would like to add WOFS into my elua build but I see Hard fault handler print register value when I issue ls command in the shell, 
I found the problem may come from DM_INSTANCE_DATA. The name was never printed if the dir name is /wo.
Did I lost something ?

My elua source are up to date except what I changed in /plateform/stm32f2.

Thanks,

Roger
  
static void shell_ls( int argc, char **argv )
{
  const DM_INSTANCE_DATA *pinst;
  unsigned dev, i;
  DM_DIR *d;
  struct dm_dirent *ent;
  u32 total;

  ( void )argc;
  ( void )argv;
  // Iterate through all devices, looking for the ones that can do "opendir"
  for( dev = 0; dev < dm_get_num_devices(); dev ++ )
  {
    pinst = dm_get_instance_at( dev );
    if( pinst->pdev->p_opendir_r == NULL || pinst->pdev->p_readdir_r == NULL || pinst->pdev->p_closedir_r == NULL )
      continue;
    d = dm_opendir( pinst->name );
    if( d )
    {
      total = 0;
      printf( "\n%s", pinst->name );
      while( ( ent = dm_readdir( d ) ) != NULL )
      {
        printf( "\n%s", ent->fname );
        for( i = strlen( ent->fname ); i <= DM_MAX_FNAME_LENGTH; i++ )
          printf( " " );
        printf( "%u bytes", ( unsigned )ent->fsize );
        total = total + ent->fsize;
      }
      printf( "\n\nTotal on %s: %u bytes\n", pinst->name, ( unsigned )total );
      dm_closedir( d );
    }
  }
  printf( "\n" );
}


_______________________________________________
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: WOFS question

Hi,

On Mon, Jul 16, 2012 at 1:09 PM, Roger Lin <[hidden email]> wrote:

> HI,
>
> I would like to add WOFS into my elua build but I see Hard fault handler
> print register value when I issue ls command in the shell,
> I found the problem may come from DM_INSTANCE_DATA. The name was never
> printed if the dir name is /wo.
> Did I lost something ?
>
> My elua source are up to date except what I changed in /plateform/stm32f2.
>
> Thanks,
>
> Roger
>
>
> static void shell_ls( int argc, char **argv )
>
> {
>   const DM_INSTANCE_DATA *pinst;
>
>   unsigned dev, i;
>
>   DM_DIR *d;
>
>   struct dm_dirent *ent;
>
>   u32 total;
>
>
>   ( void )argc;
>
>   ( void )argv;
>
>   // Iterate through all devices, looking for the ones that can do "opendir"
>
>   for( dev = 0; dev < dm_get_num_devices(); dev ++ )
>
>   {
>     pinst = dm_get_instance_at( dev );
>
>     if( pinst->pdev->p_opendir_r == NULL || pinst->pdev->p_readdir_r == NULL
> || pinst->pdev->p_closedir_r == NULL )
>
>       continue;
>     d = dm_opendir( pinst->name );
>
>     if( d )
>
>     {
>       total = 0;
>
>       printf( "\n%s", pinst->name );
>
>       while( ( ent = dm_readdir( d ) ) != NULL )
>
>       {
>         printf( "\n%s", ent->fname );
>
>         for( i = strlen( ent->fname ); i <= DM_MAX_FNAME_LENGTH; i++ )
>
>           printf( " " );
>
>         printf( "%u bytes", ( unsigned )ent->fsize );
>
>         total = total + ent->fsize;
>
>       }
>       printf( "\n\nTotal on %s: %u bytes\n", pinst->name, ( unsigned )total
> );
>
>       dm_closedir( d );
>
>     }
>   }
>   printf( "\n" );
>
> }
>
>
>
>

I don't have a STM32F2, thus I can't test this directly. I know it
works on STM32F1, so I'm a bit confused. A few things:

- did you erase the whole flash when programming the eLua firmware or
only the needed flash sectors? You should erase the whole flash.
- how is your Flash configuration defined?
- can you add more printfs in the shell_ls function in order to debug
the problem? For example, put a printf after 'pinst =
dm_get_instance_at( dev );' that displays the value of "pinst". Add
more printfs until you can pinpont the exact area where the fault
happens.

Best,
Bogdan

 _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
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: WOFS question

Another question: are you using a special branch for your STM32F2
board? I don't see any official support for STM32F2 in our master. In
particular, the F1/F2 flash access function seem to be quite a bit
different  ...

Best,
Bogdan

On Mon, Jul 16, 2012 at 1:46 PM, Bogdan Marinescu
<[hidden email]> wrote:

> Hi,
>
> On Mon, Jul 16, 2012 at 1:09 PM, Roger Lin <[hidden email]> wrote:
>> HI,
>>
>> I would like to add WOFS into my elua build but I see Hard fault handler
>> print register value when I issue ls command in the shell,
>> I found the problem may come from DM_INSTANCE_DATA. The name was never
>> printed if the dir name is /wo.
>> Did I lost something ?
>>
>> My elua source are up to date except what I changed in /plateform/stm32f2.
>>
>> Thanks,
>>
>> Roger
>>
>>
>> static void shell_ls( int argc, char **argv )
>>
>> {
>>   const DM_INSTANCE_DATA *pinst;
>>
>>   unsigned dev, i;
>>
>>   DM_DIR *d;
>>
>>   struct dm_dirent *ent;
>>
>>   u32 total;
>>
>>
>>   ( void )argc;
>>
>>   ( void )argv;
>>
>>   // Iterate through all devices, looking for the ones that can do "opendir"
>>
>>   for( dev = 0; dev < dm_get_num_devices(); dev ++ )
>>
>>   {
>>     pinst = dm_get_instance_at( dev );
>>
>>     if( pinst->pdev->p_opendir_r == NULL || pinst->pdev->p_readdir_r == NULL
>> || pinst->pdev->p_closedir_r == NULL )
>>
>>       continue;
>>     d = dm_opendir( pinst->name );
>>
>>     if( d )
>>
>>     {
>>       total = 0;
>>
>>       printf( "\n%s", pinst->name );
>>
>>       while( ( ent = dm_readdir( d ) ) != NULL )
>>
>>       {
>>         printf( "\n%s", ent->fname );
>>
>>         for( i = strlen( ent->fname ); i <= DM_MAX_FNAME_LENGTH; i++ )
>>
>>           printf( " " );
>>
>>         printf( "%u bytes", ( unsigned )ent->fsize );
>>
>>         total = total + ent->fsize;
>>
>>       }
>>       printf( "\n\nTotal on %s: %u bytes\n", pinst->name, ( unsigned )total
>> );
>>
>>       dm_closedir( d );
>>
>>     }
>>   }
>>   printf( "\n" );
>>
>> }
>>
>>
>>
>>
>
> I don't have a STM32F2, thus I can't test this directly. I know it
> works on STM32F1, so I'm a bit confused. A few things:
>
> - did you erase the whole flash when programming the eLua firmware or
> only the needed flash sectors? You should erase the whole flash.
> - how is your Flash configuration defined?
> - can you add more printfs in the shell_ls function in order to debug
> the problem? For example, put a printf after 'pinst =
> dm_get_instance_at( dev );' that displays the value of "pinst". Add
> more printfs until you can pinpont the exact area where the fault
> happens.
>
> Best,
> Bogdan
>
>  _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Roger Lin Roger Lin
Reply | Threaded
Open this post in threaded view
|

Re: WOFS question

In reply to this post by BogdanM
Hi,

Thanks for your reply. 
-- I did not erase whole flash. I used the last 2 sectors (total 256 KB) to store some data before but it wastes a lot of space. When I download new build, I did not erase these 2 sectors.
-- The STM32F2 flash sectors have different sizes, so I use the sectors 5 ~11 for WOFS. They all have 128K. I also modified flash_find_sector to make sure the return sector number start from sector 5. Below is the flash sector address:

#define ADDR_FLASH_SECTOR_0  ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */
#define ADDR_FLASH_SECTOR_1  ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */
#define ADDR_FLASH_SECTOR_2  ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */
#define ADDR_FLASH_SECTOR_3  ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */
#define ADDR_FLASH_SECTOR_4  ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */
#define ADDR_FLASH_SECTOR_5  ((uint32_t)0x08020000) /* Base @ of Sector 5,128 Kbytes */
#define ADDR_FLASH_SECTOR_6  ((uint32_t)0x08040000) /* Base @ of Sector 6,128 Kbytes */
#define ADDR_FLASH_SECTOR_7  ((uint32_t)0x08060000) /* Base @ of Sector 7,128 Kbytes */
#define ADDR_FLASH_SECTOR_8  ((uint32_t)0x08080000) /* Base @ of Sector 8,128 Kbytes */
#define ADDR_FLASH_SECTOR_9  ((uint32_t)0x080A0000) /* Base @ of Sector 9,128 Kbytes */
#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10,128 Kbytes */
#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11,128 Kbytes */

--Yes, I can. It's my only way to find problem. I don't know how to online debug just like IAR or Keil IDE. I develop elua on windows 7 with PSpad.

Thanks,
Roger


- did you erase the whole flash when programming the eLua firmware or
only the needed flash sectors? You should erase the whole flash.
- how is your Flash configuration defined?
- can you add more printfs in the shell_ls function in order to debug
the problem? For example, put a printf after 'pinst =
dm_get_instance_at( dev );' that displays the value of "pinst". Add
more printfs until you can pinpont the exact area where the fault
happens. 

On Mon, Jul 16, 2012 at 6:46 PM, Bogdan Marinescu <[hidden email]> wrote:
Hi,

On Mon, Jul 16, 2012 at 1:09 PM, Roger Lin <[hidden email]> wrote:
> HI,
>
> I would like to add WOFS into my elua build but I see Hard fault handler
> print register value when I issue ls command in the shell,
> I found the problem may come from DM_INSTANCE_DATA. The name was never
> printed if the dir name is /wo.
> Did I lost something ?
>
> My elua source are up to date except what I changed in /plateform/stm32f2.
>
> Thanks,
>
> Roger
>
>
> static void shell_ls( int argc, char **argv )
>
> {
>   const DM_INSTANCE_DATA *pinst;
>
>   unsigned dev, i;
>
>   DM_DIR *d;
>
>   struct dm_dirent *ent;
>
>   u32 total;
>
>
>   ( void )argc;
>
>   ( void )argv;
>
>   // Iterate through all devices, looking for the ones that can do "opendir"
>
>   for( dev = 0; dev < dm_get_num_devices(); dev ++ )
>
>   {
>     pinst = dm_get_instance_at( dev );
>
>     if( pinst->pdev->p_opendir_r == NULL || pinst->pdev->p_readdir_r == NULL
> || pinst->pdev->p_closedir_r == NULL )
>
>       continue;
>     d = dm_opendir( pinst->name );
>
>     if( d )
>
>     {
>       total = 0;
>
>       printf( "\n%s", pinst->name );
>
>       while( ( ent = dm_readdir( d ) ) != NULL )
>
>       {
>         printf( "\n%s", ent->fname );
>
>         for( i = strlen( ent->fname ); i <= DM_MAX_FNAME_LENGTH; i++ )
>
>           printf( " " );
>
>         printf( "%u bytes", ( unsigned )ent->fsize );
>
>         total = total + ent->fsize;
>
>       }
>       printf( "\n\nTotal on %s: %u bytes\n", pinst->name, ( unsigned )total
> );
>
>       dm_closedir( d );
>
>     }
>   }
>   printf( "\n" );
>
> }
>
>
>
>

I don't have a STM32F2, thus I can't test this directly. I know it
works on STM32F1, so I'm a bit confused. A few things:

- did you erase the whole flash when programming the eLua firmware or
only the needed flash sectors? You should erase the whole flash.
- how is your Flash configuration defined?
- can you add more printfs in the shell_ls function in order to debug
the problem? For example, put a printf after 'pinst =
dm_get_instance_at( dev );' that displays the value of "pinst". Add
more printfs until you can pinpont the exact area where the fault
happens.

Best,
Bogdan

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


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

Re: WOFS question

In reply to this post by BogdanM
Yes, I start from jsnyder's branch. I adjust some different IOs, UART, clock. The flash access function is a little different between F1/F2.

Thanks,

Roger   

On Mon, Jul 16, 2012 at 11:14 PM, Bogdan Marinescu <[hidden email]> wrote:
Another question: are you using a special branch for your STM32F2
board? I don't see any official support for STM32F2 in our master. In
particular, the F1/F2 flash access function seem to be quite a bit
different  ...

Best,
Bogdan

On Mon, Jul 16, 2012 at 1:46 PM, Bogdan Marinescu
<[hidden email]> wrote:
> Hi,
>
> On Mon, Jul 16, 2012 at 1:09 PM, Roger Lin <[hidden email]> wrote:
>> HI,
>>
>> I would like to add WOFS into my elua build but I see Hard fault handler
>> print register value when I issue ls command in the shell,
>> I found the problem may come from DM_INSTANCE_DATA. The name was never
>> printed if the dir name is /wo.
>> Did I lost something ?
>>
>> My elua source are up to date except what I changed in /plateform/stm32f2.
>>
>> Thanks,
>>
>> Roger
>>
>>
>> static void shell_ls( int argc, char **argv )
>>
>> {
>>   const DM_INSTANCE_DATA *pinst;
>>
>>   unsigned dev, i;
>>
>>   DM_DIR *d;
>>
>>   struct dm_dirent *ent;
>>
>>   u32 total;
>>
>>
>>   ( void )argc;
>>
>>   ( void )argv;
>>
>>   // Iterate through all devices, looking for the ones that can do "opendir"
>>
>>   for( dev = 0; dev < dm_get_num_devices(); dev ++ )
>>
>>   {
>>     pinst = dm_get_instance_at( dev );
>>
>>     if( pinst->pdev->p_opendir_r == NULL || pinst->pdev->p_readdir_r == NULL
>> || pinst->pdev->p_closedir_r == NULL )
>>
>>       continue;
>>     d = dm_opendir( pinst->name );
>>
>>     if( d )
>>
>>     {
>>       total = 0;
>>
>>       printf( "\n%s", pinst->name );
>>
>>       while( ( ent = dm_readdir( d ) ) != NULL )
>>
>>       {
>>         printf( "\n%s", ent->fname );
>>
>>         for( i = strlen( ent->fname ); i <= DM_MAX_FNAME_LENGTH; i++ )
>>
>>           printf( " " );
>>
>>         printf( "%u bytes", ( unsigned )ent->fsize );
>>
>>         total = total + ent->fsize;
>>
>>       }
>>       printf( "\n\nTotal on %s: %u bytes\n", pinst->name, ( unsigned )total
>> );
>>
>>       dm_closedir( d );
>>
>>     }
>>   }
>>   printf( "\n" );
>>
>> }
>>
>>
>>
>>
>
> I don't have a STM32F2, thus I can't test this directly. I know it
> works on STM32F1, so I'm a bit confused. A few things:
>
> - did you erase the whole flash when programming the eLua firmware or
> only the needed flash sectors? You should erase the whole flash.
> - how is your Flash configuration defined?
> - can you add more printfs in the shell_ls function in order to debug
> the problem? For example, put a printf after 'pinst =
> dm_get_instance_at( dev );' that displays the value of "pinst". Add
> more printfs until you can pinpont the exact area where the fault
> happens.
>
> Best,
> Bogdan
>
>  _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


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