Errors: 1
I asked an expert and learned that the error was that the RAM allocation exceeded 256B.
Solution 1 is:
1. Open 18f452.lkr.
The RAM allocation is
ACCESSBANK NAME=accessram START=0x0 END=0x7F
DATABANK NAME=gpr0 START=0x80 END=0xFF DATABANK NAME=gpr1 START=0x100 END=0x1FF
DATABANK NAME=gpr2 START=0x200 END=
0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x3FF DATABANK NAME=
gpr4 START=0x400 END=0x4FF
DATABANK NAME=gpr5 START=0x500 END=0x5FF
ACCESSBANK NAME=accesssfr START=0xF80 END=0xFFF PROTECTED
SECTION NAME=CONFIG ROM=config
STACK SIZE=0x100 RAM=gpr5
2. Change the gpr0 range to START=0x80 END=0x4FF
as follows:
DATABANK NAME=gpr0 START=0x80 END=0x4FF
and mask the rest. gpr5 is the stack address and does not need to be changed.
3. Recompile, OK~~
Method 2: Create an array area to store large arrays (refer to the paging in the 18f452.lkr file)
For MPLAB C18 compiler, data can be placed in data memory or program memory. If there is no
additional code provided by the user, the data in the on-chip program memory can only be read but not written. If there is no additional code provided by the user,
the data in the off-chip program memory can generally only be read or written.
For example, the following statement declares a section for statically allocated uninitialized data (udata) at absolute address
0x120:
#pragma udata my_new_data_section=0x120
The rom keyword tells the compiler that the variable should be placed in program memory. The compiler will allocate this variable to
the current romdata type segment. For example:
#pragma romdata const_table
const rom char my_const_array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
/* Resume allocation of romdata into the default section */
#pragma romdata
The linker forces the romdata section to be placed in program memory and the udata and idata sections to be placed in data memory;
however, data sections can also be located in specific memory areas. You can use the SECTION directive in the linker script
to allocate a section to a specific memory area.
Method 3: Define data in ROM (ROM is not paged)
Previous article:pic microcontroller, linker description file (*.lkr) meaning
Next article:pic's further understanding of header files (based on PIC microcontroller C18 compiler)
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Analyze and constrain timing in ISE
- How to enter timer5 interrupt in GD32F103C8T6
- New metering technology makes every drop of water count
- How to set a pin to high impedance
- Introduction to TWS Bluetooth headsets and TI low-power solutions
- BlueNRG-1 controls 8 WS2812B chips to realize EEWORLD display with a shake stick
- Which series of 51 microcontrollers is cheaper?
- Brushed servo based on STM8S003F3P6
- I use a 1588bs dot matrix, and the results are always different from the ideal
- Understanding the difference between FIR filter and IIR filter in one article