structure problems

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys, I have the following struct:

 

struct ff_file{

    char folder_name[255];
    unsigned int cluster_addr;
    unsigned int cluster_nr;
    char * cluster_data;

    char current_working_type;

    int nr;
    struct directories * start_chain;

    int indexing;
    char * size_pump;
    unsigned long long file_size;

    char file_name[255];
    unsigned int data_cluster_addr;
    unsigned int data_cluste_nr;
    char * free_data;
    char * ptr_to_data;
};

 

when I add additional members the system fails, this is after a long run of stupid errors in the project I'm working on.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What chip? How much RAM do you have spare?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SAMA5D44, 512MBytes of lovely DDR RAM ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fianawarrior wrote:
the system fails,
Not much of an engineering report is it? Define "fails".

 

The likelihood seems to be it's something about sizeof(). Perhaps some code was making some assumption about how big this object is that is render invalid if it is grown?

 

Are you malloc()ing, memcpy()ing, memset()ing etc etc?

 

Even the 255 sizes for folder/file seem a bit arbitrary - what is dictating those? Might they ever encounter something outside this limit (esp the folder name part).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Solved, it seems to have went away after changing to the 8.1 ARM GCC and I also added a object file to be compiled.  Whatever fixed it I'm happy.  Just a bit pissed recently with lots of small but significant bugs in the code.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let’s say you write correct code 95% of the time- in 1000 lines, you’ll have 50 defects. Software development is complex that’s why there’s various strategies to control the complexity and to control the number of defects.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One of the key concepts is design before implementation. Another useful approach is to develop unit tests to test the modularised code before you implement it.