Skip to content

boards: cleanup structure of wsn430 boards#8061

Merged
miri64 merged 2 commits intoRIOT-OS:masterfrom
haukepetersen:opt_boards_wsn430
Jan 24, 2018
Merged

boards: cleanup structure of wsn430 boards#8061
miri64 merged 2 commits intoRIOT-OS:masterfrom
haukepetersen:opt_boards_wsn430

Conversation

@haukepetersen
Copy link
Copy Markdown
Contributor

@haukepetersen haukepetersen commented Nov 16, 2017

rebased on #8058, alternative to #7975

So when not taking the path of board revisions and just cleaning up the code tree a little bit, it seems to me we can achieve the same thing. For this PR just compare this commit from #7975 b64b8b0 with the same done in this PR e02f33f.

The changes look pretty similar, and I think we might as well get away with keeping a dedicated folder per board (variant), and just improving on the code sharing part... So I tend to close #7975 again and simply go with structural cleanups based on #8058.

@haukepetersen haukepetersen changed the title Opt boards wsn430 boards: cleanup structure of wsn430 boards Nov 16, 2017
@haukepetersen haukepetersen added Area: boards Area: Board ports Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Platform: MSP Platform: This PR/issue effects MSP-based platforms State: waiting for other PR State: The PR requires another PR to be merged first labels Nov 16, 2017
@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 State: waiting for other PR State: The PR requires another PR to be merged first labels Nov 30, 2017
@haukepetersen
Copy link
Copy Markdown
Contributor Author

reabsed

Copy link
Copy Markdown
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

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

I've "tested" examples/default with a wsn430-v1_3b on the iotlab tesbed site in strasbourg and wsn430-v1_4 on euratech. "tested" simply means running the firmware on the node and "help" returned the expected output. Though I approve this PR, I'd like someone who has more experience with that platform to review the changes.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Nov 30, 2017

Does it make sense to merge this? The WSN430 are soon to be deactivated I read on Tuesday on the IoT-Lab-Mailinglist (whose archive isn't public so I sadly can't link).

@PeterKietzmann
Copy link
Copy Markdown
Member

Not on all sites. I think it is too early to remove that port completely.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Nov 30, 2017

Alright then. Hit the green ;-)

@PeterKietzmann
Copy link
Copy Markdown
Member

Is this an ACK after reviewing the code?

@miri64
Copy link
Copy Markdown
Member

miri64 commented Nov 30, 2017

Is this an ACK after reviewing the code?

You already ACK'd. Is a second ACK necessary?

@PeterKietzmann
Copy link
Copy Markdown
Member

I asked for one (above), so yes. I'm not so familiar with these platforms and their code base.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Nov 30, 2017

Ah sorry ^^" no I think I'm even less familiar than you.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

rebased.

@PeterKietzmann: as you have been running this code on the nodes, I think this makes you currently the only expert we have on these boards... So I don't think we will ever get someone else to give a better review then you did. So my proposal: @miri64 looks hard at the changes once more, and we merge this PR with both of your (more or less expert) verdicts.

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

One coding convention issue, one proposal, otherwise the code is just moved around a little so I think if addressed (at least the coding convention part) we can merged this.

}

/* oscillator fault flag still set? */
while ((IFG1 & OFIFG) != 0);
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.

Why are you writing the while loop here without a body, but the for-loop above you are writing with (empty) body. In general loops without bodies can lead to cross-platform problems and our coding conventions state they should be with a body

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

japp, this is a mistake here, will fix.

break;
default:
/* MCLK and SMCLK = XT2 (safe) */
BCSCTL2 = (SELM_2 | SELS);
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.

Minor optimization proposal: why not make the MCLK_... defines names for theses combinations of flags?

#define MCLK_2MHZ_SCLK_1MHZ (SELM_2 | DIVM_2 | SELS | DIVS_3)
#define MCLK_4MHZ_SCLK_1MHZ (SELM_2 | DIVM_1 | SELS | DIVS_3)
#define MCLK_8MHZ_SCLK_1MHZ (SELM_2 | SELS | DIVS_3)
#define MCLK_8MHZ_SCLK_8MHZ (SELM_2 | SELS)

then you can just BSCTL2 = speed. Or does that not make any sense?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yap, obviously :-) Should have seen this myself, thanks!

@haukepetersen
Copy link
Copy Markdown
Contributor Author

addressed comments

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Last round of nit-picks ;-)


/*---------------------------------------------------------------------------*/
void msp430_init_dco(void)
void msp430_init_cpuclk(uint32_t speed)
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.

Isn't used from extern anymore => can be static


/*---------------------------------------------------------------------------*/
void msp430_init_dco(void)
void msp430_init_cpuclk(uint32_t speed)
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.

Also, BCSCTL2 seems to be char according to most sources I was able to find (and the header files of the toolchain). So why not use uint8_t for speed?

@haukepetersen
Copy link
Copy Markdown
Contributor Author

fixed.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 24, 2018

Tested on both wsn430_1.3b and wsn430_1.4 with examples/default and still works. Please squash.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

squashed.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

ups, broke the do-while loop when squashing, fixed now.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Jan 24, 2018

"Re"-tested on iotlab-m3 for both platforms. This time with the right commit ^^"

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

ACK

@miri64 miri64 merged commit 8ab837c into RIOT-OS:master Jan 24, 2018
@haukepetersen
Copy link
Copy Markdown
Contributor Author

thanks!

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 Platform: MSP Platform: This PR/issue effects MSP-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants