Skip to content

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.
#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