platformio / platform-intel_mcs51

Intel MCS-51 (8051): development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/intel_mcs51
Apache License 2.0
56 stars 44 forks source link

Add dual DPTR support for STC #25

Closed NickLiu635 closed 5 years ago

NickLiu635 commented 5 years ago

STC15 series have dual DPTR, controlled via DPS at 0xA2.0.here's the document

P297 3.3.3 Dual Data Pointer Register(DPTR)

SDCC supports it.,p89c51r

https://sourceforge.net/p/sdcc/wiki/8051%20Variants/

ivankravets commented 5 years ago

Thanks!

zerog2k commented 5 years ago

@NickLiu635 did you test this with recent sdcc versions, especially 3.8.4 which is toolchain-sdcc shipped currently w/ platformio?

hackpro:clock-3118AY jens$ pio run -v
Processing stc15f2k60s2 (platform: https://github.com/platformio/platform-intel_mcs51.git; board: stc15f2k60s2; upload_protocol: stcgal)
---------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/intel_mcs51/stc15f2k60s2.html
PLATFORM: Intel MCS-51 (8051) 1.2.1 #b0ddf49 (git+https://github.com/platformio/platform-intel_mcs51.git) > Generic STC15F2K60S2
HARDWARE: STC15F2K60S2 6MHz, 2KB RAM, 60KB Flash
PACKAGES: tool-stcgal 1.104.0 (1.4), toolchain-sdcc 1.30804.10766 (3.8.4)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
No dependencies
sdcc -o .pio/build/stc15f2k60s2/src/adc.rel -c --std-sdcc11 --opt-code-size --peep-return -mp89c51r -DF_CPU=6000000 -DHEAP_SIZE=128 -DPLATFORMIO=40000 -Isrc src/adc.c
sdcc -o .pio/build/stc15f2k60s2/src/alarm.rel -c --std-sdcc11 --opt-code-size --peep-return -mp89c51r -DF_CPU=6000000 -DHEAP_SIZE=128 -DPLATFORMIO=40000 -Isrc src/alarm.c
sdcc -o .pio/build/stc15f2k60s2/src/delay.rel -c --std-sdcc11 --opt-code-size --peep-return -mp89c51r -DF_CPU=6000000 -DHEAP_SIZE=128 -DPLATFORMIO=40000 -Isrc src/delay.c
at 1: error 131: cannot generate code for target 'p89c51r'
sdcc -o .pio/build/stc15f2k60s2/src/display.rel -c --std-sdcc11 --opt-code-size --peep-return -mp89c51r -DF_CPU=6000000 -DHEAP_SIZE=*** [.pio/build/stc15f2k60s2/src/adc.rel] Error 1
128 -DPLATFORMIO=40000 -Isrc src/display.c
at 1: error 131: cannot generate code for target 'p89c51r'
*** [.pio/build/stc15f2k60s2/src/delay.rel] Error 1
at 1: error 131: cannot generate code for target 'p89c51r'
*** [.pio/build/stc15f2k60s2/src/alarm.rel] Error 1
at 1: error 131: cannot generate code for target 'p89c51r'
*** [.pio/build/stc15f2k60s2/src/display.rel] Error 1
================================= [ERROR] Took 0.72 seconds ====

I think this change breaks support with current sdcc, which does not seem to have these target types listed in the wiki. (maybe @spth knows more about this?)

I suspect that sdcc wiki might be quite outdated. Only documentation for sdcc I can trust is the latest sdcc manual, i.e. http://sdcc.sourceforge.net/doc/sdccman.pdf (e.g. Section 4.1.2) That indicates that it does not support it for mcs51 target.

ivankravets commented 5 years ago

@zerog2k I've just reverted this PR https://github.com/platformio/platform-intel_mcs51/pull/26

@NickLiu635 did you test it with PlatformIO's toolchain?

NickLiu635 commented 5 years ago

@zerog2k I've just reverted this PR #26

@NickLiu635 did you test it with PlatformIO's toolchain?

I tested it ,with PlatformIO IDE for VSCode, PlatformIO didn't show any warning nor error.

However, I noticed that

4.1.2 Other Features available by SFR Some MCS51 variants offer features like Dual DPTR, multiple DPTR, decrementing DPTR, 16x16 Multiply. These are currently not used for the MCS51 port. If you absolutely need them you can fall back to inline assembly or submit a patch to SDCC.

in sdccman,page 61 http://sdcc.sourceforge.net/doc/sdccman.pdf

SORRY.

spth commented 5 years ago

I suspect that sdcc wiki might be quite outdated. Only documentation for sdcc I can trust is the latest sdcc manual, i.e. http://sdcc.sourceforge.net/doc/sdccman.pdf (e.g. Section 4.1.2)

As documented in the first paragraph of the wiki page, that page is about planned backends to get support for dual dptr. But maybe the wording needs to be improved to clarify. Currently, we only have the mcs51 backend for the MCS-51 and derivatives (and the ds390 for the Dallas DS390, which is derived from MCS-51, but quite different in some ways).