Skip to content

cpu/stm32l1: header updated and isr vector cleanup#7687

Closed
haukepetersen wants to merge 4 commits intoRIOT-OS:masterfrom
haukepetersen:opt_stm32l1_isrvectors
Closed

cpu/stm32l1: header updated and isr vector cleanup#7687
haukepetersen wants to merge 4 commits intoRIOT-OS:masterfrom
haukepetersen:opt_stm32l1_isrvectors

Conversation

@haukepetersen
Copy link
Copy Markdown
Contributor

follow up on #7535

This PR also updates the vendor headers as the used one was quite outdated.

@haukepetersen haukepetersen added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 6, 2017
@haukepetersen haukepetersen added this to the Release 2017.10 milestone Oct 6, 2017
@haukepetersen haukepetersen changed the title Opt stm32l1 isrvectors cpu/stm32l1: header updated and isr vector cleanup Oct 6, 2017
@haukepetersen haukepetersen added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Oct 6, 2017
@haukepetersen haukepetersen force-pushed the opt_stm32l1_isrvectors branch from beec2f7 to 181fb7d Compare October 10, 2017 13:07
@haukepetersen haukepetersen removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Oct 10, 2017
@haukepetersen
Copy link
Copy Markdown
Contributor Author

rebased

@haukepetersen haukepetersen added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 10, 2017
@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Oct 13, 2017

needs rebase

@haukepetersen
Copy link
Copy Markdown
Contributor Author

rebased.

smlng
smlng previously requested changes Nov 13, 2017
Copy link
Copy Markdown
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

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

made some tests with nucleo-l152:

  • example/default okay
  • tests/periph_gpio fail, hard fault
  • tests/periph_i2c fail, hard fault
  • tests/periph_spi okay

which is a minor improvement over current master, where everything fails.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

not good. Will check.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

I have a different behavior here: tests/periph_gpio and tests/i2c work as expected, but default goes into hard-fault once I input something to the shell...

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

mhm, I just made one pass, so I was lucky on some - but in general its not deterministic?

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

@haukepetersen: yep now example/defaults failed for me, too 😢

@haukepetersen
Copy link
Copy Markdown
Contributor Author

To simplify things, I am looking into tests/shell right now. As the shell works with the tests/periph_gpio test, I con't expect this too be a problem with the uart driver, but rather something more system related.

What I can tell so far: tests/shell fails with this PR (hard fault on rx), but if I comment out the DISABLE_MODULE += auto_init in the Makefile, then it works... But no idea what this means so far.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

haukepetersen commented Nov 13, 2017

seems like we broke the board/cpu a while back. git bisect lead me to believe that dd49f22 broke the board, though I can't really tell why this is.

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

but that commit would break then all cortex-m based CPUs which it certainly doesn't because others still work.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

Just tried it: manuall reverting the changes from dd49f22 on the current master makes the nucleo-l152 behave as expected again. So something is with this change that the l1 doesn't like.

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

@haukepetersen the difference is that irq_restore is mapped to irq_arch_restore which is

/**
 * @brief Restore the state of the IRQ flags
 */
void irq_arch_restore(unsigned int state)
{
    __set_PRIMASK(state);
}

problem: it doesn't call __enable_irq() while irq_disable() is mapped to irq_arch_disable which is:

/**
 * @brief Disable all maskable interrupts
 */
unsigned int irq_arch_disable(void)
{
    uint32_t mask = __get_PRIMASK();
    __disable_irq();
    return mask;
}

and does __disable_irq()

@haukepetersen
Copy link
Copy Markdown
Contributor Author

so __enable_irq() -> __ASM volatile ("cpsie i" : : : "memory");
and restore: -> __set_PRIMASK(state);

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

we can say for sure, that replacing these to lines does not result in the same functions called, at least the now used restore does something different and does not call __enable_irq(), I wonder why other platforms are not showing this behaviour. I mean I mostly tests with remote-revb and PhyNode (pba-d-01-kwx2) which are both cortex-m as well, but so far no problem with them.

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

we can say for sure, that replacing these to lines

as in the commit by @vincent-d you found

@smlng
Copy link
Copy Markdown
Member

smlng commented Nov 13, 2017

ah forget about the remotes, they do not use cortexm_sleep so they shouldn't be affected, but maybe its a similar problem why I had to exclude them.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

Just put the question into #7385. Either there is a quick fix, or this will be one of those hard to fix issues...

Anyway, I am pretty sure the issue at hand is unrelated to the changes in this PR. Would you be ok with merging this PR and keeping track of the broken stm32l1 in a different place?

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Jan 11, 2018

This needs rebase @haukepetersen.

Maybe @kYc0o you can give this one a try (since you seem to also have the hardware) ?

Copy link
Copy Markdown
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

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

Some minor comments, will test.

isr_tim6, /* [43] TIM6 global Interrupt */
isr_tim7, /* [44] TIM7 global Interrupt */
/* shared vectors for all family members */
[WWDG_IRQn ] = isr_wwdg, /* [ 0] Window WatchDog Interrupt */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any special reason to align the closing bracket with so much spaces?

[USB_FS_WKUP_IRQn ] = isr_usb_fs_wkup, /* [42] USB FS WakeUp from suspend through EXTI Line Interrupt */
[TIM6_IRQn ] = isr_tim6, /* [43] TIM6 global Interrupt */
[TIM7_IRQn ] = isr_tim7, /* [44] TIM7 global Interrupt */

Copy link
Copy Markdown
Contributor

@kYc0o kYc0o Jan 12, 2018

Choose a reason for hiding this comment

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

Any special reason for the extra space here and below? (just curiosity, I'm not against it)

@smlng
Copy link
Copy Markdown
Member

smlng commented Jan 16, 2019

needs rebase

@stale
Copy link
Copy Markdown

stale bot commented Aug 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 10, 2019
@smlng smlng added State: don't stale State: Tell state-bot to ignore this issue and removed State: stale State: The issue / PR has no activity for >185 days labels Aug 12, 2019
@smlng
Copy link
Copy Markdown
Member

smlng commented Aug 12, 2019

as such changes are done for other MCU already, this should be moved forward (again). Hence, don't close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms State: don't stale State: Tell state-bot to ignore this issue Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants