Solution to memory overflow error during 8 s Compilation

Source: Internet
Author: User

?

Result cosmic Report"Segment. ubsct Overflow"The root cause of the error isMemory Overflow, The Cause analysis is as follows:

?

1. Variable storage space structure

?

The RAM address range of the 8s105 series CPU is 0 ~ 2 K space of 0x7ff, in which 512 bytes are allocated to the stack by default, leaving 0 ~ 0x5ff is the variable storage space. From 0 ~ Within the spatial range of 0x5ff, 256 bytes are defined as zero page, including. BSCT,. ubsct,. Bit,. Share

?

It can be seen that when the segment. ubsct overflow error occurs, it should be 0 ~ FF segment space Overflow

?

By default, cosmic stores all variables in the zero page segment. If you want to place the variables in the 0x100 ~ In the space 0x5ff, you need to add @ near declaration before the variable, just like the idata function.

?

Add @ near Declaration to all global variables to store buckets outside zero page.

?

However, it is not too difficult to compile variables. After carefully reading the materials, we found that ccompiler can be found in the project settings to change memort models to long stack.

?

The last method fails on ipv8s903k3. You can use the @ near method to select some variables with low usage frequency and add @ near before it.

?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.