Code: Select all
.init_array :
{
. = ABSOLUTE(0x17000) ;
*(.codec_bin_section_1)
KEEP (*(.init_array*))
. = ALIGN(0x4) ;
} > REGION_TEXTINRAMCode: Select all
__attribute__((section(".init_array"))) uint8_t Codec[15000];Code: Select all
.init_array :
{
. = ABSOLUTE(0x17000) ;
*(.codec_bin_section_1)
KEEP (*(.init_array*))
. = ALIGN(0x4) ;
} > REGION_TEXTINRAMCode: Select all
__attribute__((section(".init_array"))) uint8_t Codec[15000];So... Do you still have a problem with the codec using RAM that is used by compiler variables etc?R3MDG wrote: ↑Mon Jun 02, 2025 1:20 amThank you, the vocoder code has fixed addresses, when the firmware is launched it transfers this code from flash to IRAM, since the code works faster there, I realized that I need to deal with the linker script and do something like this:
and already in the source code add:Code: Select all
.init_array : { . = ABSOLUTE(0x17000) ; *(.codec_bin_section_1) KEEP (*(.init_array*)) . = ALIGN(0x4) ; } > REGION_TEXTINRAM
something like thisCode: Select all
__attribute__((section(".init_array"))) uint8_t Codec[15000];
Code: Select all
asm volatile (
"push r4-r11\n"
"subi sp, sp, 0x14\n"
"stw r1, (sp, 0x0C)\n"
"movi r1, 0x00002000\n"
"stw r1, (sp, 0x08)\n"
"movi r1, 1\n"
"stw r1, (sp, 0x04)\n"
"movi r1, 0x00000800\n"
"stw r1, (sp, 0x00)\n"
"movi r3, 0x50\n"
"movi r1, 0\n"
"jsri " QU(AMBE_ENCODE)
"addi sp, sp, 0x14\n"
"pop r4-r11"
);This assembler code calls the function and passes a pointer to a buffer, and probably some other parametersR3MDG wrote: ↑Mon Jun 02, 2025 11:04 amat the moment i am ready for trial tests, i have one question about stack, stack frame needs to be prepared?
Code: Select all
asm volatile ( "push r4-r11\n" "subi sp, sp, 0x14\n" "stw r1, (sp, 0x0C)\n" "movi r1, 0x00002000\n" "stw r1, (sp, 0x08)\n" "movi r1, 1\n" "stw r1, (sp, 0x04)\n" "movi r1, 0x00000800\n" "stw r1, (sp, 0x00)\n" "movi r3, 0x50\n" "movi r1, 0\n" "jsri " QU(AMBE_ENCODE) "addi sp, sp, 0x14\n" "pop r4-r11" );
IDE CDS latest version: https://drive.google.com/file/d/1twAQ-W ... sp=sharing
this is already code for C-SKY, it just often uses the stack to store variables and you may have to make a copy of the stackVK3KYY wrote: ↑Mon Jun 02, 2025 8:54 pmThis assembler code calls the function and passes a pointer to a buffer, and probably some other parametersR3MDG wrote: ↑Mon Jun 02, 2025 11:04 amat the moment i am ready for trial tests, i have one question about stack, stack frame needs to be prepared?
Code: Select all
asm volatile ( "push r4-r11\n" "subi sp, sp, 0x14\n" "stw r1, (sp, 0x0C)\n" "movi r1, 0x00002000\n" "stw r1, (sp, 0x08)\n" "movi r1, 1\n" "stw r1, (sp, 0x04)\n" "movi r1, 0x00000800\n" "stw r1, (sp, 0x00)\n" "movi r3, 0x50\n" "movi r1, 0\n" "jsri " QU(AMBE_ENCODE) "addi sp, sp, 0x14\n" "pop r4-r11" );
Someone posted a pure C version of this to the forum, but we did not use it because I think it caused the code size to increase
However you should probably use the C version, because this would be easier than porting the ARM code to CSky
The full source code of the project, to make it clearer, all comments like //*** or /*** are only mine, so as not to confuse with the author's
Code: Select all
void HRC7000InitDTMF(void)
{
/*** SPI0WritePageRegByteExtended(0x01, 0x11B, 0x05); //configure 697 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x11A, 0x93); //
SPI0WritePageRegByteExtended(0x01, 0x11D, 0x06); //configure 770 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x11C, 0x29); //
SPI0WritePageRegByteExtended(0x01, 0x11F, 0x06); //configure 852 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x11E, 0xD1); //
SPI0WritePageRegByteExtended(0x01, 0x121, 0x07); //configure 941 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x120, 0x87); //
SPI0WritePageRegByteExtended(0x01, 0x123, 0x09); //configure 1209 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x122, 0xAC); //
SPI0WritePageRegByteExtended(0x01, 0x125, 0x0A); //configure 1336 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x124, 0xB0); //
SPI0WritePageRegByteExtended(0x01, 0x127, 0x0B); //configure 1447 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x126, 0xD1); //
SPI0WritePageRegByteExtended(0x01, 0x129, 0x0D); //configure 1633 Hz tone
SPI0WritePageRegByteExtended(0x01, 0x128, 0x10); //
***/
*FM_TONE1 = 0x05930629;
*FM_TONE2 = 0x06D10787;
*FM_TONE3 = 0x09AC0AB0;
*FM_TONE4 = 0x0BD10D10;
}Code: Select all
void radioPowerOn(void)
{
//Turn off Tx Voltages to prevent transmission.
//*** HAL_GPIO_WritePin(PA_EN_1_GPIO_Port, PA_EN_1_Pin, GPIO_PIN_RESET);
//*** HAL_GPIO_WritePin(PA_EN_2_GPIO_Port, PA_EN_2_Pin, GPIO_PIN_RESET);
GPIO_DRV_SetOutput( PA_SEL_VHF, 0);
GPIO_DRV_SetOutput( PA_SEL_UHF, 0);
GPIO_DRV_SetOutput( PA_SEL_SW, 0);
//Turn on all receiver voltages. (thats what the TYT firmware does, both receivers are on together)
radioSetRxLNAForDevice(currentRadioDeviceId);
//**** HAL_GPIO_WritePin(C6000_PWD_GPIO_Port, C6000_PWD_Pin, GPIO_PIN_RESET);// Power On the C6000
//Turn on the Microphone power
//*** HAL_GPIO_WritePin(MICPWR_SW_GPIO_Port, MICPWR_SW_Pin, GPIO_PIN_SET);
}