Giter Club home page Giter Club logo

Comments (13)

endeavour avatar endeavour commented on July 23, 2024 1

Great, I managed to flash system.hex successfully :) Is there a way to use dfuload to copy the remaining files from approot in one go with wildcards or do I have to send each file individually?

from la104.

gabonator avatar gabonator commented on July 23, 2024

Just comment out that include line. And please let me know if it helped

from la104.

endeavour avatar endeavour commented on July 23, 2024

Thanks for quick reply. Now I get a lot more errors:


dfuload.cpp: In function ‘int root_dir_addr(int, bpb33*)’:
dfuload.cpp:20:5: error: ‘uint32_t’ was not declared in this scope
     uint32_t offset;
     ^~~~~~~~
dfuload.cpp:20:5: note: suggested alternative: ‘u_int32_t’
     uint32_t offset;
     ^~~~~~~~
     u_int32_t
dfuload.cpp:21:5: error: ‘offset’ was not declared in this scope
     offset =
     ^~~~~~
dfuload.cpp:21:5: note: suggested alternative: ‘off_t’
     offset =
     ^~~~~~
     off_t
dfuload.cpp: In function ‘void fill_clusters(FILE*, int, bpb33*)’:
dfuload.cpp:119:5: error: ‘uint32_t’ was not declared in this scope
     uint32_t clust_size;
     ^~~~~~~~
dfuload.cpp:119:5: note: suggested alternative: ‘u_int32_t’
     uint32_t clust_size;
     ^~~~~~~~
     u_int32_t
dfuload.cpp:120:5: error: ‘uint8_t’ was not declared in this scope
     uint8_t *buf;
     ^~~~~~~
dfuload.cpp:120:5: note: suggested alternative: ‘u_int8_t’
     uint8_t *buf;
     ^~~~~~~
     u_int8_t
dfuload.cpp:120:14: error: ‘buf’ was not declared in this scope
     uint8_t *buf;
              ^~~
dfuload.cpp:121:13: error: expected ‘;’ before ‘rdl’
     uint32_t rdl;
             ^~~~
             ;
dfuload.cpp:122:13: error: expected ‘;’ before ‘total’
     uint32_t total = 0;
             ^~~~~~
             ;
dfuload.cpp:124:5: error: ‘clust_size’ was not declared in this scope
     clust_size = bpb->bpbSecPerClust * bpb->bpbBytesPerSec;
     ^~~~~~~~~~
dfuload.cpp:125:20: error: expected primary-expression before ‘)’ token
     buf = (uint8_t*)malloc(clust_size);
                    ^
dfuload.cpp:130:2: error: ‘rdl’ was not declared in this scope
  rdl = fread(buf, 1, clust_size, fd);
  ^~~
dfuload.cpp:138:9: error: ‘total’ was not declared in this scope
         total += rdl;
         ^~~~~
dfuload.cpp:138:9: note: suggested alternative: ‘strtol’
         total += rdl;
         ^~~~~
         strtol
dfuload.cpp:139:14: error: ‘rdl’ was not declared in this scope
     } while (rdl == clust_size);
              ^~~
dfuload.cpp:141:46: error: ‘total’ was not declared in this scope
     dprintf("\nFinished writing %d bytes\n", total);
                                              ^~~~~
dfuload.cpp:141:46: note: suggested alternative: ‘strtol’
     dprintf("\nFinished writing %d bytes\n", total);
                                              ^~~~~
                                              strtol
dfuload.cpp: In function ‘int main(int, const char**)’:
dfuload.cpp:191:15: error: ‘F_NOCACHE’ was not declared in this scope
     fcntl(fd, F_NOCACHE, 1);
               ^~~~~~~~~
fat12tool.cpp:60:1: error: ‘uint16_t’ does not name a type; did you mean ‘u_int16_t’?
 uint16_t get_fat_entry(uint16_t clusternum,
 ^~~~~~~~
 u_int16_t
fat12tool.cpp:97:20: error: variable or field ‘set_fat_entry’ declared void
 void set_fat_entry(uint16_t clusternum, uint16_t value,
                    ^~~~~~~~
fat12tool.cpp:97:20: error: ‘uint16_t’ was not declared in this scope
fat12tool.cpp:97:20: note: suggested alternative: ‘u_int16_t’
 void set_fat_entry(uint16_t clusternum, uint16_t value,
                    ^~~~~~~~
                    u_int16_t
fat12tool.cpp:97:41: error: ‘uint16_t’ was not declared in this scope
 void set_fat_entry(uint16_t clusternum, uint16_t value,
                                         ^~~~~~~~
fat12tool.cpp:97:41: note: suggested alternative: ‘u_int16_t’
 void set_fat_entry(uint16_t clusternum, uint16_t value,
                                         ^~~~~~~~
                                         u_int16_t
fat12tool.cpp:98:6: error: expected primary-expression before ‘int’
      int fdi, struct bpb33* bpb)
      ^~~
fat12tool.cpp:98:15: error: expected primary-expression before ‘struct’
      int fdi, struct bpb33* bpb)
               ^~~~~~
fat12tool.cpp: In function ‘int root_dir_addr(int, bpb33*)’:
fat12tool.cpp:212:5: error: ‘uint32_t’ was not declared in this scope
     uint32_t offset;
     ^~~~~~~~
fat12tool.cpp:212:5: note: suggested alternative: ‘u_int32_t’
     uint32_t offset;
     ^~~~~~~~
     u_int32_t
fat12tool.cpp:213:5: error: ‘offset’ was not declared in this scope
     offset =
     ^~~~~~
fat12tool.cpp:213:5: note: suggested alternative: ‘off_t’
     offset =
     ^~~~~~
     off_t
fat12tool.cpp: At global scope:
fat12tool.cpp:220:23: error: ‘uint16_t’ was not declared in this scope
 int cluster_to_addr_i(uint16_t cluster, int fd,
                       ^~~~~~~~
fat12tool.cpp:220:23: note: suggested alternative: ‘u_int16_t’
 int cluster_to_addr_i(uint16_t cluster, int fd,
                       ^~~~~~~~
                       u_int16_t
fat12tool.cpp:220:41: error: expected primary-expression before ‘int’
 int cluster_to_addr_i(uint16_t cluster, int fd,
                                         ^~~
fat12tool.cpp:221:5: error: expected primary-expression before ‘struct’
     struct bpb33* bpb)
     ^~~~~~
fat12tool.cpp:221:22: error: expression list treated as compound expression in initializer [-fpermissive]
     struct bpb33* bpb)
                      ^
fat12tool.cpp:236:1: error: ‘uint8_t’ does not name a type; did you mean ‘u_int8_t’?
 uint8_t *cluster_to_addr(uint16_t cluster, int fd,
 ^~~~~~~
 u_int8_t
fat12tool.cpp:256:16: error: variable or field ‘listfiles’ declared void
 void listfiles(uint16_t cluster, int fd, struct bpb33* bpb)
                ^~~~~~~~
fat12tool.cpp:256:16: error: ‘uint16_t’ was not declared in this scope
fat12tool.cpp:256:16: note: suggested alternative: ‘u_int16_t’
 void listfiles(uint16_t cluster, int fd, struct bpb33* bpb)
                ^~~~~~~~
                u_int16_t
fat12tool.cpp:256:34: error: expected primary-expression before ‘int’
 void listfiles(uint16_t cluster, int fd, struct bpb33* bpb)
                                  ^~~
fat12tool.cpp:256:42: error: expected primary-expression before ‘struct’
 void listfiles(uint16_t cluster, int fd, struct bpb33* bpb)
                                          ^~~~~~
fat12tool.cpp:313:61: error: ‘uint16_t’ has not been declared
 /*struct direntry* */ int find_file(const char *infilename, uint16_t cluster,
                                                             ^~~~~~~~
fat12tool.cpp: In function ‘int find_file(const char*, int, int, int, bpb33*)’:
fat12tool.cpp:321:5: error: ‘uint16_t’ was not declared in this scope
     uint16_t dir_cluster;
     ^~~~~~~~
fat12tool.cpp:321:5: note: suggested alternative: ‘u_int16_t’
     uint16_t dir_cluster;
     ^~~~~~~~
     u_int16_t
fat12tool.cpp:324:52: error: ‘cluster_to_addr_i’ cannot be used as a function
     int offset = cluster_to_addr_i(cluster, fd, bpb);
                                                    ^
fat12tool.cpp:373:10: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
   return NULL;
          ^~~~
fat12tool.cpp:390:7: error: ‘dir_cluster’ was not declared in this scope
       dir_cluster = getushort(dirent.deStartCluster);
       ^~~~~~~~~~~
fat12tool.cpp:390:7: note: suggested alternative: ‘cluster’
       dir_cluster = getushort(dirent.deStartCluster);
       ^~~~~~~~~~~
       cluster
fat12tool.cpp:410:16: error: ‘get_fat_entry’ was not declared in this scope
      cluster = get_fat_entry(cluster, fd, bpb);
                ^~~~~~~~~~~~~
fat12tool.cpp:413:56: error: ‘cluster_to_addr_i’ cannot be used as a function
             offset = cluster_to_addr_i(cluster, fd, bpb);
                                                        ^
fat12tool.cpp: At global scope:
fat12tool.cpp:418:1: error: ‘uint16_t’ does not name a type; did you mean ‘u_int16_t’?
 uint16_t copy_in_file(FILE* fd, int fdi, struct bpb33* bpb,
 ^~~~~~~~
 u_int16_t
fat12tool.cpp:509:6: error: ‘uint16_t’ has not been declared
      uint16_t start_cluster, uint32_t size)
      ^~~~~~~~
fat12tool.cpp:509:30: error: ‘uint32_t’ has not been declared
      uint16_t start_cluster, uint32_t size)
                              ^~~~~~~~
fat12tool.cpp:580:6: error: ‘uint16_t’ has not been declared
      uint16_t start_cluster, uint32_t size,
      ^~~~~~~~
fat12tool.cpp:580:30: error: ‘uint32_t’ has not been declared
      uint16_t start_cluster, uint32_t size,
                              ^~~~~~~~
fat12tool.cpp: In function ‘void create_dirent(int, const char*, int, int, int, bpb33*)’:
fat12tool.cpp:598:14: error: ‘uint8_t’ was not declared in this scope
      memset((uint8_t*)&dirent, 0, sizeof(struct direntry));
              ^~~~~~~
fat12tool.cpp:598:14: note: suggested alternative: ‘u_int8_t’
      memset((uint8_t*)&dirent, 0, sizeof(struct direntry));
              ^~~~~~~
              u_int8_t
fat12tool.cpp:598:22: error: expected primary-expression before ‘)’ token
      memset((uint8_t*)&dirent, 0, sizeof(struct direntry));
                      ^
fat12tool.cpp: In function ‘void copyin(const char*, const char*, int, bpb33*)’:
fat12tool.cpp:622:5: error: ‘uint16_t’ was not declared in this scope
     uint16_t start_cluster;
     ^~~~~~~~
fat12tool.cpp:622:5: note: suggested alternative: ‘u_int16_t’
     uint16_t start_cluster;
     ^~~~~~~~
     u_int16_t
fat12tool.cpp:623:5: error: ‘uint32_t’ was not declared in this scope
     uint32_t size = 0;
     ^~~~~~~~
fat12tool.cpp:623:5: note: suggested alternative: ‘u_int32_t’
     uint32_t size = 0;
     ^~~~~~~~
     u_int32_t
fat12tool.cpp:654:5: error: ‘start_cluster’ was not declared in this scope
     start_cluster = copy_in_file(fd, fdi, bpb, &size);
     ^~~~~~~~~~~~~
fat12tool.cpp:654:5: note: suggested alternative: ‘static_assert’
     start_cluster = copy_in_file(fd, fdi, bpb, &size);
     ^~~~~~~~~~~~~
     static_assert
fat12tool.cpp:654:49: error: ‘size’ was not declared in this scope
     start_cluster = copy_in_file(fd, fdi, bpb, &size);
                                                 ^~~~
fat12tool.cpp:654:49: note: suggested alternative: ‘nice’
     start_cluster = copy_in_file(fd, fdi, bpb, &size);
                                                 ^~~~
                                                 nice
fat12tool.cpp:654:21: error: ‘copy_in_file’ was not declared in this scope
     start_cluster = copy_in_file(fd, fdi, bpb, &size);
                     ^~~~~~~~~~~~
fat12tool.cpp:654:21: note: suggested alternative: ‘copyin’
     start_cluster = copy_in_file(fd, fdi, bpb, &size);
                     ^~~~~~~~~~~~
                     copyin
fat12tool.cpp: In function ‘bool checkCompatibility(int, bpb33*)’:
fat12tool.cpp:669:47: error: ‘cluster_to_addr_i’ cannot be used as a function
     int offset = cluster_to_addr_i(0, fdi, bpb);
                                               ^
fat12tool.cpp: In function ‘int main(int, const char**)’:
fat12tool.cpp:688:15: error: ‘F_NOCACHE’ was not declared in this scope
     fcntl(fd, F_NOCACHE, 1);
               ^~~~~~~~~
fat12tool.cpp:716:7: error: ‘listfiles’ was not declared in this scope
       listfiles(root, fd, bpb);
       ^~~~~~~~~
fat12tool.cpp:740:42: error: ‘get_fat_entry’ was not declared in this scope
         printf("cluster 0x%x: %0x\n", i, get_fat_entry(i, fd, bpb));
                                          ^~~~~~~~~~~~~
fat12tool.cpp:746:54: error: ‘cluster_to_addr_i’ cannot be used as a function
       int offset = cluster_to_addr_i(cluster, fd, bpb);
                                                      ^
fat12tool.cpp:754:18: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
           return NULL;
                  ^~~~
fat12tool.cpp:768:9: error: ‘set_fat_entry’ was not declared in this scope
         set_fat_entry(i, 0, fd, bpb);
         ^~~~~~~~~~~~~
fat12tool.cpp:768:9: note: suggested alternative: ‘setstate_r’
         set_fat_entry(i, 0, fd, bpb);
         ^~~~~~~~~~~~~
         setstate_r
fat12tool.cpp:773:15: error: ‘uint8_t’ was not declared in this scope
       memset((uint8_t*)&dirent, 0, sizeof(struct direntry));
               ^~~~~~~
fat12tool.cpp:773:15: note: suggested alternative: ‘u_int8_t’
       memset((uint8_t*)&dirent, 0, sizeof(struct direntry));
               ^~~~~~~
               u_int8_t
fat12tool.cpp:773:23: error: expected primary-expression before ‘)’ token
       memset((uint8_t*)&dirent, 0, sizeof(struct direntry));
                       ^
fat12tool.cpp:776:46: error: ‘cluster_to_addr_i’ cannot be used as a function
       int root = cluster_to_addr_i(0, fd, bpb);
                                              ^

from la104.

gabonator avatar gabonator commented on July 23, 2024

Ok, I tired to build on linux machine and to do so, you need to do these changes:
instead
#include "i386/endian.h"
use
#include "endian.h"

in both fat12tool.cpp and dfuload.cpp before the #include "fat12.h" add this line:
#include <stdint.h>

then the compiler will complain that it cannot convert NULL to integer, so just change those lines from:
return NULL;
to
return 0;

and it should work

from la104.

endeavour avatar endeavour commented on July 23, 2024

Thanks, still getting two errors:

dfuload.cpp: In function ‘int main(int, const char**)’:
dfuload.cpp:193:15: error: ‘F_NOCACHE’ was not declared in this scope
     fcntl(fd, F_NOCACHE, 1);
               ^~~~~~~~~
fat12tool.cpp: In function ‘int main(int, const char**)’:
fat12tool.cpp:689:15: error: ‘F_NOCACHE’ was not declared in this scope
     fcntl(fd, F_NOCACHE, 1);
               ^~~~~~~~~

from la104.

gabonator avatar gabonator commented on July 23, 2024

yes, I forgot. Comment these lines out, I noticed they have no effect anyway

from la104.

endeavour avatar endeavour commented on July 23, 2024

Ok great it builds, will try and flash system.hex and let you know how I get on.

from la104.

endeavour avatar endeavour commented on July 23, 2024

Do I need to mount the disk? I tried this without any joy:

$ ./dfuload /dev/disk/by-label/DFU\\x20V3_61_D cp ../../system/release/system.hex 
Failed to open disk '/dev/disk/by-label/DFU\x20V3_61_D', errno:13

from la104.

gabonator avatar gabonator commented on July 23, 2024

No, the disk must be not mounted, otherwise you won't get full access to the device. So if you are referring to the disk through volume label, there is high probability that the disk is already mounted. Errno 13 means "Permission denied", try calling with sudo

from la104.

gabonator avatar gabonator commented on July 23, 2024

just turn the device off and on, mount it and use as regular usb memory stick

from la104.

endeavour avatar endeavour commented on July 23, 2024

Fantastic, all working now! Thanks for all your help.

from la104.

gabonator avatar gabonator commented on July 23, 2024

great to see that with those little changes it works on linux too. I will try to fix those issues so it will build on both platforms without any problems

from la104.

gabonator avatar gabonator commented on July 23, 2024

fixed by this commit
d632b51

from la104.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.