Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost FAT driver prevents compilation when USB is enabled #134

Open
jamesadevine opened this issue Apr 22, 2021 · 5 comments
Open

Ghost FAT driver prevents compilation when USB is enabled #134

jamesadevine opened this issue Apr 22, 2021 · 5 comments
Assignees

Comments

@jamesadevine
Copy link
Contributor

#if CONFIG_ENABLED(DEVICE_USB)

@mmoskal is there anyway we can be more precise with the conditional compilation of the GhostFAT driver?

The board I am working on has not defined BOOTLOADER_START_ADDR and UF2_DEFINE_HANDOVER so functions required by the GhostFAT driver are not being defined by uf2format.h. This breaks compilation:

/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp: In member function 'virtual void codal::GhostFAT::writeBlocks(int, int)':
/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp:304:22: error: 'uf2_info' was not declared in this scope
  304 |     const char *p0 = uf2_info(), *p = p0;
      |                      ^~~~~~~~
/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp:305:13: error: 'p' was not declared in this scope; did you mean 'p0'?
  305 |     while (*p && *p != '\n')
      |             ^
      |             p0
/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp:307:12: error: 'p' was not declared in this scope; did you mean 'p0'?
  307 |     while (p > p0)
      |            ^
      |            p0
/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp:324:17: error: 'check_uf2_handover' was not declared in this scope
  324 |                 check_uf2_handover(buf, numBlocks, in->ep & 0xf, out->ep & 0xf, cbwTag());
      |                 ^~~~~~~~~~~~~~~~~~
/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp: In member function 'virtual void codal::GhostFAT::addFiles()':
/Users/James/Desktop/VM/MSR/makeable/libraries/codal-core/source/drivers/GhostFAT.cpp:470:19: error: 'uf2_info' was not declared in this scope
  470 |     addStringFile(uf2_info(), "info_uf2.txt");
      |                   ^~~~~~~~

Do you see any issue with guarding the compilation of this driver using the BOOTLOADER_START_ADDR define?

@jamesadevine
Copy link
Contributor Author

@mmoskal thoughts?

@mmoskal
Copy link
Contributor

mmoskal commented Apr 23, 2021

yes, you can disable the whole driver, but what prevents you from specifying the bootloader addresses?

@jamesadevine
Copy link
Contributor Author

Nothing on my particular board. Though, in the future we might have some boards that support USB, but do not yet have UF2. I think it is better to not cause a compiler error by default in any case.

@mmoskal
Copy link
Contributor

mmoskal commented Apr 23, 2021

so if bootloader range is not defined you could just not add "info_uf2.txt" file and don't check for handover in writeBlocks. Typically the user would instantiate (or derive from) this class and add more files.

@jamesadevine
Copy link
Contributor Author

@mmoskal see #135 . Let me know if this patch looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants