IOsetting / hk32f030m-template

HSXP HK32F030M template project for GNU Arm Embedded Toolchain
Apache License 2.0
32 stars 3 forks source link

reduce vector table size #3

Open nerdralph opened 1 year ago

nerdralph commented 1 year ago

Since there`s gaps in the vector table, you can put some of the startup code there to save flash. https://github.com/nerdralph/stm32f0-blink/blob/master/src/vector_table.S#L29

deividAlfa commented 1 year ago

Why so much hassle to save few dozens of flash bytes?

nerdralph commented 1 year ago

Why so much hassle to save few dozens of flash bytes?

I didn't think copying my vector table asm code would be a hassle.

deividAlfa commented 1 year ago

I can see the bss zeroing, but where's the data initialization?

IOsetting commented 1 year ago

Hi Ralph, is it feasible to add a new startup file e.g. "startup_hk32f030mf4p6_compact.s"? Then user can choose different options in Makefile for compiling.

nerdralph commented 1 year ago

Hi Ralph, is it feasible to add a new startup file e.g. "startup_hk32f030mf4p6_compact.s"? Then user can choose different options in Makefile for compiling.

I suppose, but what would be the reason not to use a smaller init all the time? I think the effort of adding makefile options would be better spent on making a single optimized init.

IOsetting commented 1 year ago

Hi Ralph, I got your point. In a fixed scenario, a smaller init would be preferred, users will benefit from these hacks. This is a project template for a rarely known chip, I feel that at this phase, a standard startup file would be best for most users, readable, reliable. Changing the startup file only need to edit one line in Makefile so no effort needed, if most users feel the smaller init is stable and good in most cases, we can set it as default.

nerdralph commented 1 year ago

That's a reasonable choice to make for someone who doesn't have as much confidence in my code as I do.

On Wed, Jan 4, 2023 at 8:45 AM IOsetting @.***> wrote:

Hi Ralph, I got your point. In a fixed scenario, a smaller init would be preferred, users will benefit from these hacks. This is a project template for a rarely known chip, I feel that at this phase, a standard startup file would be best for most users, readable, trustable. Changing the startup file only need to edit one line in Makefile so no effort needed, if most users feel the smaller init is stable and good in most cases, we can set it as default.

— Reply to this email directly, view it on GitHub https://github.com/IOsetting/hk32f030m-template/issues/3#issuecomment-1370887882, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKNZ6QGGDVYRRVLNA6YFJDWQVWGZANCNFSM6AAAAAATPECKSI . You are receiving this because you authored the thread.Message ID: @.***>