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

Use VECT_TAB_OFFSET from upload method #111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmlambo
Copy link
Contributor

@dmlambo dmlambo commented Sep 21, 2023

Add bootloader flags to compilation of c, cpp and S files.

Add bootloader flags to compilation of c, cpp and S files.
@@ -40,7 +40,7 @@
#define __HXTAL (HXTAL_VALUE) /* high speed crystal oscillator frequency */
#define __SYS_OSC_CLK (__IRC8M) /* main oscillator frequency */

#define VECT_TAB_OFFSET (uint32_t)0x00 /* vector table base offset */
//#define VECT_TAB_OFFSET (uint32_t)0x00 /* vector table base offset */
Copy link
Member

@maxgerhardt maxgerhardt Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a

#ifndef VECT_TAB_OFFSET  
#define VECT_TAB_OFFSET ...
#endif 

here to allow a user-overridable value, would that not mean that this file tries to use a hardcoded vector table offset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pulled in from platform.txt. The variable build.bootloader_flags=-DVECT_TAB_OFFSET={build.flash_offset} wasn't being used anywhere. flash_offset is being used to inform the linker script through LD_FLASH_OFFSET={build.flash_offset}.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if -DVECT_TAB_OFFSET={build.flash_offset} is additionally set as global compiler settings, would that not cause a "VECT_TAB_OFFEST redefined" warning in GCC when compiling this file like in https://stackoverflow.com/a/73518725?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it would, so the correct way for the user to override it would be setting build.flash_offset.

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

Successfully merging this pull request may close these issues.

2 participants