CAN bus (software part 1)

Source: Internet
Author: User

When debugging can, I found a bug in Zhou licong's startup code of the lpc2100. I hope you can avoid it.

Previously, we used the lpc2214 and lpc2210 chips for the first time. I thought that the startup code can be used in a general sense, and I found that I always ran into the data suspension interruption when the program was running. it took a long time to find out that the problem was caused by the distributed file loading.

Find the mem_c.scf or mem_a.scf file (the content of the two files is the same). Its original code is as follows:

Rom_load 0x00000000

{

Rom_exec 0x00000000

{

Startup. O (vectors, + first)

* (+ RO)

}

 

Iram 0x40000000

{

Startup. O (mystacks)

* (+ RW, + zi)

}

 

Heap + 0 uninit

{

Startup. O (HEAP)

}

 

Stacks 0x40004000 uninit

{

Startup. O (stacks)

}

}

Heap locates the bottom of the stack, and the bottom of the stack is located above Zi. Therefore, "+ 0" is used, and heap will increase from this address.

Stacks locates the top of the stack, which is at the top of the memory that can be used as storage. Stacks drops from the top address of the stack.

It can be seen that from 0x40000000 to 0x40004000 is 16kb, but the lpc2109 only has 8 K in-chip RAM. this is why the program is interrupted. after changing 0x40004000 to 0x40002000, the program runs normally. in addition, if you want to perform one-step debugging in Ram, modify the settings in mem_ B .scf accordingly. the method is the same as above.

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.