Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

1.Compile environment

  • Toolchain Install:

SDCC:

1、apt install sdcc

...

Replace this two files with the same files under linux/kernel/drivers/misc/iop/.

2.Makefile

  • SDCC_NOGENRAMCLEAR

...

Adding the SDCC_NOGENRAMCLEAR environment variable during the compilation phase can skip the action of clearing IRAM during the system startup phase, mainly to avoid clearing the initialization data of RISC passed to IOP through IOP_DATA (for example, the i2c slave address passed to IOP through IOP_DATA0), this is a requirement of SDCC.

...

The code size of normal mode is limited to 64k.

3.standby

Standby work mode

...

After power-on reset, SP7021 will enter S0 in which all modules of SP7021 are powered. This is a state of full power and function.

...

Because tmpx is only used to read the code area data, and tmpx is not used, volatile modification is required when defining tmpx variables, otherwise SDCC will optimize the code inside the for loop.

...

In addition to the above-mentioned judgment IR_RTC_Status, S1mode wake-up can also wake up the system through the input status of GPIO_IV_MX0--IV_MX6 (S3mode GPIO is not work).

4.Normal

  • crtstart.asm

...

crtstart.asm is the SDCC startup file. The location of start_stack is modified mainly to avoid conflicts between the system default stack location and 8051 registers. Sunplus 8051 is a special register at 0x30-0x80. Some registers cannot be overwritten, but general 8051 single-chip microcomputer 0x30--0x80 is the RAM area, which can be used casually.

...

  • For example:

set GPIO_P1_03(G_MX11) to Output mode, and set it to high level output:

1. G101.25 |= (0x1<<11); // RISC setting, IO port is in GPIO mode

2. G6.0 = (0x1<<(11+16))|(0x0<<11); // RISC setting, IOP control

3. GPIO_IO1_CFG |= (0x1<<3); // IOP setting, output mode

4. GPIO_PORT1_OUT |= (0x1<<3); // IOP setting, output high level

Set GPIO_P2_04(G_MX20) to input mode:

1. G101.25 |= (0x1<<20); // RISC setting, IO port is in GPIO mode

...

3. GPIO_IO2_CFG &= ~(0x1<<4); // IOP setting, output mode

4. If((GPIO_PORT2_IN & (0x1<<4)) == (0x1<<4)) //IOP setting, output high level

...