Some 8051 mcu hasn't any ext bus.use "MOVX" may be RESET them.
and crt is too big to fit into some low-price MCU(120B).So I fix it(20B).
FIX LARGE crt and MOVX BUG...
Thanks for the contribution, but...
This is no bug. If the program does not use any xdata then those MOVX instructions will not be executed.
And your modifications only introduce bugs and fix none. You are free to provide your own crtinit.asm when compiling but this will not be merged into the SDCC source tree.
Further, if your MCU is so small that it can't handle 100 bytes extra then I wonder if you're not better off programming in assembly.
No,I mean,STC15F104 has some bug.
Like,excute "MOVX" or "MOV __XPAGE",It can make it RESET.
I don't worried about the CODE SIZE.'Cause it has 4KB ROM and 128B Ram.
But it only has 8pins,5 i/o ports.So P2(XPAGE) has DISABLED.And ext. BUS has DISABLED.
STC datasheet has been said "Any MOVX/Set unknown sfrs will reset the MCU".
So,XPAGE/ext.BUS code in program start can make MCU reset,and can't move PC to main().
at this point,I fixup the CRT,port it can be used for STC15F100 series MCU.
I 'm so worried my English grammer.Because I 'm a Chinese.and I just a high school student...
Please don't laugh me，Thank you~
Dear Zhi Yuan Wan,
I apologize if I have offended you. I will certainly not laugh at you. Instead I want to welcome you as a contributing SDCC user.
When no external ram is used in your program then neither MOVX nor _XPAGE are used. And crtxstack.asm will not even be linked in. Further you can easily remap _XPAGE to a register that can be written with no effect (e.g. B) as explained in the manual. If you want to help SDCC you can provide a header file with SFR definitions for this MCU in the patch tracker.
IMHO a MOVX should never result in reset on an 8051 derivative, but it may be treated as a NOP when there is no xdata. If this MCU really does reset I consider that a bug in the MCU.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.