Improper use of #elif to test if an address is defined (breaks axidma tests in normal config)
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.2k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Most of the dma test examples have a block that looks something like this
#ifdef XPAR_AXI_7SDDR_0_S_AXI_BASEADDR
#define DDR_BASE_ADDR XPAR_AXI_7SDDR_0_S_AXI_BASEADDR
#elif XPAR_MIG7SERIES_0_BASEADDR
#define DDR_BASE_ADDR XPAR_MIG7SERIES_0_BASEADDR
#elif XPAR_MIG_0_BASEADDR
#define DDR_BASE_ADDR XPAR_MIG_0_BASEADDR
#elif XPAR_PSU_DDR_0_S_AXI_BASEADDR
#define DDR_BASE_ADDR XPAR_PSU_DDR_0_S_AXI_BASEADDR
#endif
The problem is that while the first preprocessor test is using an #ifdef the else statements check for a truth instead of an define. In many cases the base address will be 0 for XPAR_PSU_DDR_0_S_AXI_BASEADDR so the build results in a warning and picks a poor choice for the address. This bug is not just in the dma code, and #elif code that checks for an address should be using defined like this #elif defined(XPAR_PSU_DDR_0_S_AXI_BASEADDR)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with XilinxProcessorIPLib/drivers/axidma/examples/xaxidma_example_sg_poll.c around line 110, then search the repository for similar #elif checks involving address macros. Confirm each conditional tests whether the macro is defined, and verify the affected DMA examples build without the reported warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100