Skip to content

RIOT/Makefile.include: added indicating of possibe conflicting features on compile#2076

Merged
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
BytesGalore:add_conflict_warning
May 8, 2015
Merged

RIOT/Makefile.include: added indicating of possibe conflicting features on compile#2076
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
BytesGalore:add_conflict_warning

Conversation

@BytesGalore
Copy link
Copy Markdown
Member

Using SPI0 and DAC0 on the stm32f4discovery at the same time, may result in unexpected behaviour as the DAC0 is internally wired with the SPI0 port of the board.

With this PR the user is informed during compile time whenever multiple, probably conflicting, features set in the variable EXPECT_CONFLICT in the Makefile.features of the individual board, are also required by a project.

@PeterKietzmann
Copy link
Copy Markdown
Member

To give a little motivation for this PR: on stm32f4discovery boards there are the same pins for the DAC and/or SPI_0. Moving the DAC to other pins is not possible. Moving SPI_0 does not make sense as the onboard accelerometer is also connected to these pins. In #2018 we decided to leave the pin configuration as it is and just throw a warning if an applications needs both features.

@brummer-simon
Copy link
Copy Markdown
Member

Is it possible to detect different kinds of conflicts?

For the stm32f4discovery Board:
SPI0 and DAC0 are in conflict and ADC0 and DAC0 are in conflict, but SPI0 and ADC0 would be fine.

Can I say something like:
FEATURES_CONFLICT += periph_spi periph_dac
FEATURES_CONFLICT += periph_adc periph_dac

Without getting and error for:
FEATURES_REQUIRED += periph_spi periph_adc

@BytesGalore
Copy link
Copy Markdown
Member Author

@brummer-simon unfortunately no, the conflicting features are just parsed and if two (or more) are present in the required features of the current application the warning will be shown.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

newline missing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added.

@BytesGalore BytesGalore force-pushed the add_conflict_warning branch 3 times, most recently from bc44777 to 59588ee Compare November 25, 2014 08:23
@haukepetersen
Copy link
Copy Markdown
Contributor

Hm, I think this solution is sub-optimal. By just defining conflicts through their features I fear we end up with more false negatives then actual conflicts. The problem is I don't really have a better idea for now.

Fast idea - how about this:
We put the check for possible conflicts on the bottom of the periph_conf.h, there we could be more precise. Maybe something like this?!:

#if SPI_0 && DAC_0
#warning "Possible conflict in peripheral configuration: SPI_0 and DAC_0 use the same pins"
#endif

@PeterKietzmann
Copy link
Copy Markdown
Member

Basically I agree with you. But regarding your solution, isn't it a problem that by defualt the SPI_0_EN is defined as 1 which sets SPI_0 (same for DAC) which will throw warnings by default? Or otherwise we need to change all peripherals to be disabled by default?

@BytesGalore
Copy link
Copy Markdown
Member Author

@haukepetersen I hope that such conflicts are the exception.
I agree with @PeterKietzmann concerns here, which could result in a change on all periph_conf.h files for a (probably) small amount of occurrences where conflicts are possible.

I don't know, I'm not sticking on this PR.

@haukepetersen
Copy link
Copy Markdown
Contributor

Yep, @PeterKietzmann you are right. But the same is true for the feature based solution, right? I guess we have to think about it some more...

@BytesGalore BytesGalore added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR labels Nov 27, 2014
@BytesGalore
Copy link
Copy Markdown
Member Author

right

@BytesGalore
Copy link
Copy Markdown
Member Author

Ok, I changed the procedure to allow defining groups of conflicting features.
A group is constructed by separating features with :, e.g.:
periph_spi:periph_dac or periph_adc:periph_dac:my_cool_feature

The number of groups is not limited. Groups are separated with a whitespace, e.g.:
periph_spi:periph_dac periph_adc:periph_dac:my_cool_feature
The number of conflicting features is also not limited.

The warning only appears iff all required features are present in a conflict group.

@LudwigKnuepfer
Copy link
Copy Markdown
Member

Please add a README.md to the example which explains what the test should / shouldn't do.

@LudwigKnuepfer
Copy link
Copy Markdown
Member

(And also a test target in the Makefile would be great so that this can be automated.)

@PeterKietzmann
Copy link
Copy Markdown
Member

I do like this solution, is @haukepetersen also happy? A README would be nice, sure...

@BytesGalore
Copy link
Copy Markdown
Member Author

added README.md

@brummer-simon
Copy link
Copy Markdown
Member

Seems like a nice solution. Well done!

@BytesGalore BytesGalore force-pushed the add_conflict_warning branch 2 times, most recently from cfd8b1e to 9e47c43 Compare December 2, 2014 07:58
@PeterKietzmann
Copy link
Copy Markdown
Member

I would ACK this

@OlegHahm OlegHahm force-pushed the master branch 3 times, most recently from 9f184dd to 45554bf Compare March 31, 2015 13:01
@BytesGalore BytesGalore force-pushed the add_conflict_warning branch from a0bbfd5 to 459b7de Compare April 15, 2015 06:37
@BytesGalore
Copy link
Copy Markdown
Member Author

@PeterKietzmann @phiros I removed the test from the Makefile since I have troubles to execute the python script properly when called from the test: target.
And of course rebased to current master.

@PeterKietzmann
Copy link
Copy Markdown
Member

@phiros may I assign you? I like this feature but as there had been some discussions in the past I would like to pass this PR so someone with more experience in all that makefile stuff and with a stronger opinion on that.

@PeterKietzmann
Copy link
Copy Markdown
Member

Travis says there are several trailing whitespaces...

@BytesGalore
Copy link
Copy Markdown
Member Author

@PeterKietzmann I removed the trailing whitespaces.
Beside the need of squahing travis seems to be happy now :)

@BytesGalore BytesGalore added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Apr 20, 2015
@BytesGalore BytesGalore force-pushed the add_conflict_warning branch 4 times, most recently from fc4a9ae to 7f43a6b Compare April 27, 2015 05:39
@OlegHahm OlegHahm modified the milestone: Release 2015.06 Apr 29, 2015
@OlegHahm
Copy link
Copy Markdown
Member

OlegHahm commented May 6, 2015

@phiros, @PeterKietzmann , @BytesGalore, what's the current state?

@BytesGalore BytesGalore force-pushed the add_conflict_warning branch from 7f43a6b to 3d6f6f3 Compare May 6, 2015 08:58
@BytesGalore
Copy link
Copy Markdown
Member Author

@OlegHahm it still works as intended, and I still like it to be merged :) .
The test.py works also, but I can't figure out how I could use it in a test target,
e.g. using make BOARD=stm32f4discovery test.
Calling the script from a make target confuses things with environment variables/exports.

@BytesGalore
Copy link
Copy Markdown
Member Author

@PeterKietzmann should I squash?

@PeterKietzmann
Copy link
Copy Markdown
Member

I hoped that someone with more knowledge in the make system (e.g. @phiros) would give feedback. But as nobody NACKed this PR for a long time and this is optional more or less an optinal feature I would finally ACK this now. Yes, please squash!

@biboc
Copy link
Copy Markdown
Member

biboc commented May 7, 2015

@PeterKietzmann, did you try? If yes and it works, let's go

@BytesGalore BytesGalore force-pushed the add_conflict_warning branch from 3d6f6f3 to f9a79ee Compare May 7, 2015 19:06
@BytesGalore
Copy link
Copy Markdown
Member Author

squashed.

@BytesGalore BytesGalore removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label May 7, 2015
@PeterKietzmann
Copy link
Copy Markdown
Member

Okay, I'll do it now. ACK and go

PeterKietzmann added a commit that referenced this pull request May 8, 2015
RIOT/Makefile.include: added indicating of possibe conflicting features on compile
@PeterKietzmann PeterKietzmann merged commit 60c9899 into RIOT-OS:master May 8, 2015
@BytesGalore BytesGalore deleted the add_conflict_warning branch May 11, 2015 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants