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

Incompatible modules in standalone DANKARMULTI #2372

Open
francesco-scar opened this issue Apr 26, 2024 · 0 comments
Open

Incompatible modules in standalone DANKARMULTI #2372

francesco-scar opened this issue Apr 26, 2024 · 0 comments

Comments

@francesco-scar
Copy link
Contributor

Describe the bug
Some standalone modules are incompatible due to multiple definitions of the same functions, so we get compilation errors.

To Reproduce
Steps to reproduce the behavior:

  1. Set STANDALONE=DANKARMULTI in Makefile.platform
  2. Edit armsrc/Standalone/dankarmulti.c similarly to the following:
#include "dankarmulti.h"
#define MODE_NAME em4100emul
#define MODE_FILE "lf_em4100emul.c"
#include "dankarmulti.h"
#define MODE_NAME em4100
#define MODE_FILE "lf_em4100rswb.c"
#include "dankarmulti.h"

START_MODE_LIST
ADD_MODE(em4100emul)
ADD_MODE(em4100)
END_MODE_LIST
  1. Try to compile with make

Expected behavior
Compile successfully and get the two modules are available in standalone mode

The problem
I didn't searched exhaustively for the same problem with other modules, but with lf_em4100emul and lf_em4100rswb there are the same definitions of

static uint64_t rev_quads(uint64_t bits);
static void fill_buff(uint8_t bit);
static void construct_EM410x_emul(uint64_t id);

so just deleting them in the second file works fine.

Since dankarmulti actually includes the C source files in its own file, the static keyword doesn't help. Possible solutions are moving those common functions into a single, separate file (for example, util) or renaming each function differently in every module (maybe setting the standard to append the module name to each function or something similar). I don't know which one is the clearest solution.

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

1 participant