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

boards/nucleo-l452: initial support #8441

Merged
merged 2 commits into from
Mar 5, 2018
Merged

Conversation

fjmolinas
Copy link
Contributor

@fjmolinas fjmolinas commented Jan 25, 2018

Contribution description

Add initial support for nucleo-l452, tested on nucleo-l452re.

Issues/PRs references

@aabadie aabadie added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: boards Area: Board ports labels Jan 25, 2018
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Now that #8065 is merged this PR needs to be adapted. See how this is done with other nucleo boards.

I didn't go into the vectors.c details, I'll do that later.

@@ -0,0 +1,34 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

with #8065, this is file is no longer needed

@@ -172,32 +170,37 @@ ISR_VECTOR(1) const isr_t vector_cpu[CPU_IRQ_NUMOF] = {
[TIM1_TRG_COM_IRQn ] = isr_tim1_trg_com, /* [26] TIM1 Trigger and Commutation Interrupt */
[USB_IRQn ] = isr_usb, /* [67] USB event Interrupt */
[CRS_IRQn ] = isr_crs, /* [82] CRS global interrupt */
#elif defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG)
#elif defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG) || defined(CPU_MODEL_STM32L452RE)
Copy link
Contributor

Choose a reason for hiding this comment

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

This line could be split using \

[DFSDM1_FLT2_IRQn ] = isr_dfsdm1_flt2, /* [63] DFSDM1 Filter 2 global Interrupt */
[OTG_FS_IRQn ] = isr_otg_fs, /* [67] USB OTG FS global Interrupt */
[SAI2_IRQn ] = isr_sai2, /* [75] Serial Audio Interface 2 global interrupt */
#endif
#if defined(CPU_MODEL_STM32L432KC) || defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG)
Copy link
Contributor

Choose a reason for hiding this comment

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

This line could be split using \

@fjmolinas
Copy link
Contributor Author

@aabadie addressed comments.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Found another style issue in vectors.c. I need to have a look at the datasheet, just to be sure.

[DFSDM1_FLT2_IRQn ] = isr_dfsdm1_flt2, /* [63] DFSDM1 Filter 2 global Interrupt */
[OTG_FS_IRQn ] = isr_otg_fs, /* [67] USB OTG FS global Interrupt */
[SAI2_IRQn ] = isr_sai2, /* [75] Serial Audio Interface 2 global interrupt */
#endif
#if defined(CPU_MODEL_STM32L432KC) || defined(CPU_MODEL_STM32L476RG) || \
defined(CPU_MODEL_STM32L475VG)
[TIM7_IRQn ] = isr_tim7, /* [55] TIM7 global interrupt */
Copy link
Contributor

Choose a reason for hiding this comment

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

The indendation is off here

@fjmolinas
Copy link
Contributor Author

@aabadie about those vector files, I only added the ones I used in the functions implemented, what are the other stuff I should look for? I also excluded the ones that are not used for this specific board. Should I generalize for more cpu familiy's?

@fjmolinas
Copy link
Contributor Author

@aabadie ping

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

I think it would also be great to configure the RTT for this board. See my comment below.

# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could also add a RTT on this board, see the nucleo-l476 as an example.

Copy link
Contributor Author

@fjmolinas fjmolinas Feb 8, 2018

Choose a reason for hiding this comment

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

I don't think RTT works for L4, at least running tests/periph_rtt doesn't work on L476, doesn't work in master an doesn't work at least up to release 2017.07. I'm trying to look in to this, but it got broken along the way another stm32lx broken feature.... Considering this I would rather not implement this right now, merge the board and then add RTT in the future, what do you think @aabadie ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rtt added

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Just gave it a try with b-l475e-iot01a board:

  • examples/default: works
  • tests/periph_timer: crashes

I think the changes in vectors.c are invalid. See my comment below.

[UART4_IRQn ] = isr_uart4, /* [52] UART4 global Interrupt */
[DFSDM1_FLT0_IRQn ] = isr_dfsdm1_flt0, /* [61] DFSDM1 Filter 0 global Interrupt */
[DFSDM1_FLT1_IRQn ] = isr_dfsdm1_flt1, /* [62] DFSDM1 Filter 1 global Interrupt */
#elif defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this elif is valid. It breaks the tests/periph_timer application with the b-l475e-iot01a board (uses a STM32L475VG).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aabadie addressed issue, you are right the elif wasn't valid, changed all to just ifdef

#elif defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG)
#endif
#if defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG) || \
defined(CPU_MODEL_STM32L452RE)
Copy link
Contributor

@aabadie aabadie Feb 15, 2018

Choose a reason for hiding this comment

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

please align to the defined on previous line (like you did below)

Copy link
Contributor

Choose a reason for hiding this comment

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

@fjmolinas, can you address my comment here (that is also valid for line 176 below) ? After that, I think it can be merged

#elif defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG)
#endif
#if defined(CPU_MODEL_STM32L476RG) || defined(CPU_MODEL_STM32L475VG) || \
defined(CPU_MODEL_STM32L452RE)
[ADC1_2_IRQn ] = isr_adc1_2, /* [18] ADC1, ADC2 SAR global Interrupts */
Copy link
Contributor

Choose a reason for hiding this comment

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

This enum doesn't exist in l452 cmsis file, it's called ADC1_IRQn, like for the l432.

Copy link
Contributor Author

@fjmolinas fjmolinas Feb 15, 2018

Choose a reason for hiding this comment

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

@aabadie there an alias for l452 defined in the cmsis files at line 16034, would you rather have me use the original one?

/* Aliases for __IRQn */
#define ADC1_2_IRQn                    ADC1_IRQn

Copy link
Contributor

Choose a reason for hiding this comment

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

there an alias defined in the cmsis files at line 16034

Sorry, I didn't scroll that far ;)

would you rather have me use the original one?

I would say yes, we never know. It may simplify an update of that file if one day there's a new version from ST.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I got confused jajajaja, should or should I not use the alias. (I wasn't very clear what I meant by original one jajajaja)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean the alias was already there (ST code) or you added it for convenience ? If it's the latter, I would avoid this, otherwise, keep it like this.

Copy link
Contributor Author

@fjmolinas fjmolinas Feb 15, 2018

Choose a reason for hiding this comment

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

It was included in the original cmsis file, with this header

//
/
For a painless codes migration between the STM32L4xx device product /
/
lines, the aliases defined below are put in place to overcome the /
/
differences in the interrupt handlers and IRQn definitions. /
/
No need to update developed interrupt code when moving across /
/
product lines within the same STM32L4 Family /
/
/

So I think it's going to stay in future files too ;) .

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Found remaining problems with the vectors.

@fjmolinas
Copy link
Contributor Author

@aabadie addressed coments.

#ifndef CLOCK_LSE
/* 0: no external low speed crystal available,
* 1: external crystal available (always 32.768kHz)
* This defaults to 0 because hardware revision 'MB1136 C-01' of the nucleo-64
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this line is a copy paste from the l476, I don't think it is valid for l452re. Maybe simply remove it ?

@fjmolinas
Copy link
Contributor Author

@aabadie removed copy pasta.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

No other comments on my side, the changes look good now.

Untested-ACK

@aabadie
Copy link
Contributor

aabadie commented Mar 5, 2018

Please squash the commits in 2:

  • one for the cpu changes: cpu/stm32l4: add support for stm32l432re
  • one the for the board: boards/nucleo-l452re: initial support.

Ah, I almost forget about it, would you mind renaming the board to nucleo-l452re (marketting name) ? (See #8649). Be careful with the doxygen comments.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Found a remaining doxygen issue.

*/

/**
* @ingroup boards_nucleo-l452re
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a problem here (just noticed that sorry): this doxygen group is never defined. Have a look here for an example.

After this is fixed, we are good.

@fjmolinas
Copy link
Contributor Author

@aabadie I think that would be it, can you confirm the doxygen group thing is ok?, haven't really looked at how that works (will now jaja)

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Looks really good now ! ACK

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 5, 2018
@aabadie
Copy link
Contributor

aabadie commented Mar 5, 2018

Just triggered Murdock: I see problems coming with unittest

@fjmolinas
Copy link
Contributor Author

no problems :)

@aabadie
Copy link
Contributor

aabadie commented Mar 5, 2018

I see problems coming with unittest

No, it passed ! So let's go @fjmolinas. Well done and thanks for your patience :)

@aabadie aabadie merged commit db55004 into RIOT-OS:master Mar 5, 2018
@fjmolinas fjmolinas deleted the nucleo-l452 branch August 7, 2019 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants