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

Settings CFG_TUD_MEM_SECTION causes a section type conflict #2655

Open
1 task done
electretmike opened this issue May 22, 2024 · 3 comments
Open
1 task done

Settings CFG_TUD_MEM_SECTION causes a section type conflict #2655

electretmike opened this issue May 22, 2024 · 3 comments
Labels

Comments

@electretmike
Copy link

Operating System

Linux

Board

Custom STM32H7 based board

Firmware

class/net/ncm_device.c

What happened ?

When using CFG_TUD_MEM_SECTION I get a section conflict. This is because ntb_parameters is constant, while transmit_ntb isn't. See https://stackoverflow.com/questions/30076949/gcc-error-variable-causes-a-section-type-conflict

This could be fixed by adding two configuration values: CFG_TUD_RODATA_MEM_SECTION and CFG_TUD_BSS_MEM_SECTION and then replace all uses of CFG_TUD_MEM_SECTION with one of those two.

How to reproduce ?

#define CFG_TUSB_MEM_SECTION __attribute__ ((section(".usb_ram")))

compiler:
arm-none-eabi-gcc (Fedora 13.2.0-5.fc40) 13.2.0

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

[build] Debug/_deps/tinyusb-src/src/class/net/ncm_device.c:140:73: error: 'ntb_parameters' causes a section type conflict with 'receive_ntb' [build] 140 | CFG_TUD_MEM_SECTION CFG_TUSB_MEM_ALIGN tu_static const ntb_parameters_t ntb_parameters = { [build] | ^~~~~~~~~~~~~~ [build] Debug/_deps/tinyusb-src/src/class/net/ncm_device.c:157:58: note: 'receive_ntb' was declared here [build] 157 | CFG_TUD_MEM_SECTION CFG_TUSB_MEM_ALIGN tu_static uint8_t receive_ntb[CFG_TUD_NCM_OUT_NTB_MAX_SIZE];

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.
@electretmike
Copy link
Author

Easier solution would be to remove CFG_TUD_MEM_SECTION from the const variables. Thay are not placed in RAM anyway

@HiFiPhile
Copy link
Collaborator

HiFiPhile commented May 23, 2024

Hi, thank you for the issue, The correct fix would be add an interrupt EP buffer in CFG_TUD_MEM_SECTION, until now the only message sent is ntb_parameters but it could have other messages later.

CFG_TUD_MEM_SECTION is necessary as explained in tusb_config.h that some MCUs can only transfer to/from specific RAM region.

@rgrr

@rgrr
Copy link
Contributor

rgrr commented May 27, 2024

Hmmm... @electretmike : which NCM are you using? The old one or the recent one? Recent one has my name in the copyright (Hardy Griech).

If you are at the current one: all this section stuff was already in the original NCM driver (without looking for excuses). Thought it would be wise to not touch that part.

How is CFG_TUD_MEM_SECTION defined for your part? Perhaps this definition is simply wrong?

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

No branches or pull requests

3 participants