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

stmhal: added support for STM32F439 (non DISCO) #1857

Closed
wants to merge 1 commit into from
Closed

stmhal: added support for STM32F439 (non DISCO) #1857

wants to merge 1 commit into from

Conversation

ryannathans
Copy link
Contributor

excluding encryption/hashing hardware acceleration, that's still in the works

@dpgeorge
Copy link
Member

This looks very clean. I don't have an F439 so can't test it. @dhylands are you able to test it?

@@ -0,0 +1,87 @@
#include STM32_HAL_H
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed?

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 have no idea what it's for, it must have come from the STM32F439-DISCO port that I used as a base to get started

Copy link
Member

Choose a reason for hiding this comment

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

If it builds without this line, please remove it.

@dhylands
Copy link
Contributor

I don't have a 439 board either.

@ryannathans
Copy link
Contributor Author

@dpgeorge Removed the define, not sure what its purpose was but it compiled fine without it

@dpgeorge
Copy link
Member

@ryannathans what kind of test did you do for this port? I trust that it works, but I can't test it myself so would like to know what has been done from your end.

@ryannathans
Copy link
Contributor Author

@dbgeorge I've been running my projects on it for a few weeks without any issue (about 15 pcbs running so far). My projects use multiple UARTs, 2 SPIs, some with SD card, take up ~100kB of internal flash in .py files and dump up to a further ~10k of logs on to the flash while running. The code runs identically to when I was using the STM32F405, except it's now faster. I haven't been able to get the tests/ working (failure to connect over the COM port). I'll give them another shot on monday when I'm with the hardware again.

@dpgeorge
Copy link
Member

Ok, thanks for that, it sounds great! Do you have any custom C code/modules that you add, or is it just vanilla stmhal built for the F439?

Regarding the test/, they should "just work". Do you have a USB REPL?

@ryannathans
Copy link
Contributor Author

@dpgeorge Just vanilla at the moment (with that modified storage.c). @david-jimenez is working on a non-public bootloader to run prior to micropython but we're not running it yet. We're also investigating the encryption and hashing acceleration and looking at adding support for that - also not using it yet.

I do have a USB REPL. I was probably just either specifying the wrong COM port or I still had it open...

@dpgeorge
Copy link
Member

I'll merge this once the tests are running (and passing).

@ryannathans
Copy link
Contributor Author

I am unable to get tests to pass on Windows and I haven't worked out how to connect a COM port to my linux VM.

The problem seems to be that in the .exp files all the output has \r\n line endings but the output from the board is all \n endings. I see no other issues otherwise.

Considering there's code for windows support in "run-tests" I expect the tests to work on windows. Is it possible I'm still doing something wrong?

@dhylands
Copy link
Contributor

dhylands commented Mar 5, 2016

The .exp files actually end in just \n

The fact that you're seeing \r\n suggests that your git client is doing some type of conversion when checking out the files.

It looks like git has an autocrlf config, and you can also try creating a .gitattribute file with an entry like:

*.exp eol=lf

which according to http://git-scm.com/docs/gitattributes which make line endings on .exp files always have LF.

@ryannathans
Copy link
Contributor Author

I resolved the problem with the above fix.

@dhylands
Copy link
Contributor

dhylands commented Mar 5, 2016

I think that CPython text files created under windows will have \n translated to \r\n.

This looks like it should work under python2 and 3:
http://stackoverflow.com/questions/2536545/how-to-write-unix-end-of-line-characters-in-windows-using-python/23434608#23434608

/* top end of the stack */

/*_stack_end = ORIGIN(RAM) + LENGTH(RAM);*/
_estack = ORIGIN(RAM) + LENGTH(RAM) - 1;
Copy link
Member

Choose a reason for hiding this comment

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

@ryannathans why the "-1" here? The end of the stack should point to 1 byte above the last byte (the stack is full decending).

Copy link
Contributor

Choose a reason for hiding this comment

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

I also noticed that the stm32f411.ld (and the 429 .ld) file has a -1 in it. We should probably fix this.

Copy link
Member

Choose a reason for hiding this comment

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

@dhylands you are right... that's not good! I think the reason it works is because the MCU automagically aligns the pointer (or ignores the lower 2 bits). In that case the -1 loses us 4 bytes of RAM. I've seen this -1 problem in many places, and am pretty sure it's wrong, but would be good to verify it (yet again) and then fix all occurrences in our code.

@dpgeorge
Copy link
Member

dpgeorge commented Mar 9, 2016

Merged in ad725a6.

@ryannathans I removed the "-1" from the definition of estack in stm32f439.ld. I also made a few other minor cosmetic changes to this linker script (eg remove whitespace at end of line).

@dpgeorge dpgeorge closed this Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants