使用gcc成功编译
This commit is contained in:
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@@ -10,7 +10,8 @@
|
||||
"STM32F429_439xx",
|
||||
"ARM_MATH_CM4",
|
||||
"__FPU_PRESENT=1",
|
||||
"__packed=__attribute__ ((__packed__))"
|
||||
"__packed=__attribute__((__packed__))",
|
||||
""
|
||||
],
|
||||
"windowsSdkVersion": "10.0.22621.0",
|
||||
"compilerPath": "D:/Program Files/arm-gnu-toolchain/bin/arm-none-eabi-gcc",
|
||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -2,6 +2,8 @@
|
||||
"cmake.ignoreCMakeListsMissing": true,
|
||||
"files.associations": {
|
||||
"ft2build.h": "c",
|
||||
"ftheader.h": "c"
|
||||
"ftheader.h": "c",
|
||||
"stm32f4xx_fsmc.h": "c",
|
||||
"stm32f4xx.h": "c"
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
#include "stddef.h"
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
@@ -42,7 +42,7 @@ int ccm_perused(void) ;
|
||||
void mymem_init (void);
|
||||
|
||||
void myfree(void *ptr); //内存释放
|
||||
void *mymalloc(u32 size); //内存分配
|
||||
void *mymalloc(size_t size); //内存分配
|
||||
void *myrealloc(void *ptr,u32 size);//重新分配内存
|
||||
//分配内存并清零
|
||||
void *mycalloc (u32 size);
|
||||
|
@@ -486,7 +486,7 @@ void myfree(void *ptr)
|
||||
//首先尝试在内部分配,失败后再外部分配
|
||||
//size:内存大小(字节)
|
||||
//返回值:分配到的内存首地址.
|
||||
void *mymalloc(u32 size)
|
||||
void *mymalloc(size_t size)
|
||||
{
|
||||
IRQ_DISABLE();
|
||||
u32 offset;
|
||||
|
@@ -6,7 +6,7 @@ FIL File_JPEG;
|
||||
JDEC JPEG_Dev;
|
||||
FIL *f_jpeg = &File_JPEG;
|
||||
JDEC *jpeg_dev = &JPEG_Dev;
|
||||
__align(4) u8 jpg_buffer[JPEG_BufferSize];
|
||||
__attribute__((aligned(4))) u8 jpg_buffer[JPEG_BufferSize];
|
||||
|
||||
static u16 JPEG_X = 0; //图片显示的起始坐标
|
||||
static u16 JPEG_Y = 0; //图片显示的起始坐标
|
||||
@@ -15,7 +15,7 @@ static u16 JPEG_Y = 0; //图片显示的起始坐标
|
||||
//从文件系统里读取数据
|
||||
static UINT In_Func (JDEC* jdec,BYTE* buff,UINT ndata)
|
||||
{
|
||||
u32 rb;
|
||||
UINT rb;
|
||||
FIL *dev=(FIL*)jdec->device;
|
||||
if(buff)
|
||||
{
|
||||
|
@@ -243,7 +243,7 @@ int video_play (char *pname,int loop)
|
||||
FIL *favi;
|
||||
u8 res=0;
|
||||
u16 offset=0;
|
||||
u32 nr;
|
||||
UINT nr;
|
||||
u8 key;
|
||||
u8 i2ssavebuf;
|
||||
DAC_UserStruct dac={0};
|
||||
|
64
Project/Src/MP3/helix/arm/asmmisc_gcc.s
Normal file
64
Project/Src/MP3/helix/arm/asmmisc_gcc.s
Normal file
@@ -0,0 +1,64 @@
|
||||
#/* ***** BEGIN LICENSE BLOCK *****
|
||||
# * Version: RCSL 1.0/RPSL 1.0
|
||||
# *
|
||||
# * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
# *
|
||||
# * The contents of this file, and the files included with this file, are
|
||||
# * subject to the current version of the RealNetworks Public Source License
|
||||
# * Version 1.0 (the "RPSL") available at
|
||||
# * http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
# * the file under the RealNetworks Community Source License Version 1.0
|
||||
# * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
# * in which case the RCSL will apply. You may also obtain the license terms
|
||||
# * directly from RealNetworks. You may not use this file except in
|
||||
# * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
# * applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
# * RCSL for the rights, obligations and limitations governing use of the
|
||||
# * contents of the file.
|
||||
# *
|
||||
# * This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
# * developer of the Original Code and owns the copyrights in the portions
|
||||
# * it created.
|
||||
# *
|
||||
# * This file, and the files included with this file, is distributed and made
|
||||
# * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
# * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
# *
|
||||
# * Technology Compatibility Kit Test Suite(s) Location:
|
||||
# * http://www.helixcommunity.org/content/tck
|
||||
# *
|
||||
# * Contributor(s):
|
||||
# *
|
||||
# * ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
# AREA |.text|, CODE, READONLY
|
||||
# int xmp3_MULSHIFT32(int x, int y)
|
||||
# EXPORT xmp3_MULSHIFT32
|
||||
|
||||
.cpu cortex-m3
|
||||
.fpu softvfp
|
||||
.syntax unified
|
||||
.thumb
|
||||
.text
|
||||
|
||||
.global xmp3_MULSHIFT32
|
||||
.thumb_func
|
||||
xmp3_MULSHIFT32:
|
||||
smull r2, r0, r1, r0
|
||||
bx lr
|
||||
|
||||
|
||||
|
||||
.global xmp3_FASTABS
|
||||
.thumb_func
|
||||
xmp3_FASTABS:
|
||||
mov r1, r0
|
||||
mov r0, #0x0
|
||||
eor r0, r1, r1, asr # 31
|
||||
sub r0, r0, r1, asr # 31
|
||||
bx lr
|
||||
|
||||
.END
|
@@ -1,69 +0,0 @@
|
||||
;/* ***** BEGIN LICENSE BLOCK *****
|
||||
; * Version: RCSL 1.0/RPSL 1.0
|
||||
; *
|
||||
; * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
; *
|
||||
; * The contents of this file, and the files included with this file, are
|
||||
; * subject to the current version of the RealNetworks Public Source License
|
||||
; * Version 1.0 (the "RPSL") available at
|
||||
; * http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
; * the file under the RealNetworks Community Source License Version 1.0
|
||||
; * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
; * in which case the RCSL will apply. You may also obtain the license terms
|
||||
; * directly from RealNetworks. You may not use this file except in
|
||||
; * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
; * applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
; * RCSL for the rights, obligations and limitations governing use of the
|
||||
; * contents of the file.
|
||||
; *
|
||||
; * This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
; * developer of the Original Code and owns the copyrights in the portions
|
||||
; * it created.
|
||||
; *
|
||||
; * This file, and the files included with this file, is distributed and made
|
||||
; * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
; * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
; * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
; * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
; *
|
||||
; * Technology Compatibility Kit Test Suite(s) Location:
|
||||
; * http://www.helixcommunity.org/content/tck
|
||||
; *
|
||||
; * Contributor(s):
|
||||
; *
|
||||
; * ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
THUMB
|
||||
REQUIRE8
|
||||
PRESERVE8
|
||||
; int xmp3_MULSHIFT32(int x, int y)
|
||||
EXPORT xmp3_MULSHIFT32
|
||||
EXPORT xmp3_FASTABS
|
||||
|
||||
;.cpu cortex-m3
|
||||
;.fpu softvfp
|
||||
;.syntax unified
|
||||
;.thumb
|
||||
;.text
|
||||
|
||||
; .global xmp3_MULSHIFT32
|
||||
; .thumb_func
|
||||
xmp3_MULSHIFT32 PROC
|
||||
smull r2, r0, r1, r0
|
||||
; mov pc, lr // KJ changed to BX for Cortex
|
||||
BX lr
|
||||
ENDP
|
||||
|
||||
;.global xmp3_FASTABS
|
||||
;.thumb_func
|
||||
xmp3_FASTABS PROC
|
||||
mov r1, r0
|
||||
mov r0, #0x0
|
||||
eor r0, r1, r1, asr # 31
|
||||
sub r0, r0, r1, asr # 31
|
||||
bx lr
|
||||
ENDP
|
||||
|
||||
END
|
382
Project/Src/MP3/helix/arm/asmpoly_thumb2_gcc.s
Normal file
382
Project/Src/MP3/helix/arm/asmpoly_thumb2_gcc.s
Normal file
@@ -0,0 +1,382 @@
|
||||
.cpu cortex-m3
|
||||
.fpu softvfp
|
||||
.syntax unified
|
||||
.thumb
|
||||
.text
|
||||
|
||||
/*.equ PCM , r0*/
|
||||
PCM .req r0
|
||||
VB1 .req r1
|
||||
COEF .req r2
|
||||
|
||||
VLO .req r0
|
||||
VHI .req r3
|
||||
|
||||
SUM1LL .req r4
|
||||
SUM1LH .req r5
|
||||
SUM2LL .req r6
|
||||
SUM2LH .req r7
|
||||
SUM1RL .req r8
|
||||
SUM1RH .req r9
|
||||
SUM2RL .req r10
|
||||
SUM2RH .req r11
|
||||
|
||||
CF1 .req r12
|
||||
CF2 .req r14
|
||||
|
||||
SIGN .req r12
|
||||
MAXPOS .req r14
|
||||
|
||||
I .req r12
|
||||
|
||||
.global RNDVAL
|
||||
/* RNDVAL SETA (1 << ((32 - 12) + (6 - 1))) */
|
||||
.equ RNDVAL, 0x02000000 /*(1 << (25)) */
|
||||
|
||||
/*; C64TOS - clip 64-bit accumulator to short (no rounding)
|
||||
; xl, xh = value (lo 32, hi 32)
|
||||
; input assumed to have 6 fraction bits
|
||||
; sign = temp variable to use for sign
|
||||
; maxPos = 0x00007fff (takes 2 instr. to generate - calculating
|
||||
; once and using repeatedly saves if you do several CTOS in a row) */
|
||||
.macro C64TOS _xl, _xh, _sign, _maxPos
|
||||
mov \_xl, \_xl, lsr #(20+6)
|
||||
orr \_xl, \_xl, \_xh, lsl #(12-6)
|
||||
mov \_sign, \_xl, ASR #31
|
||||
cmp \_sign, \_xl, ASR #15
|
||||
it ne
|
||||
eorne \_xl, \_sign, \_maxPos
|
||||
.endm
|
||||
|
||||
/* ; MC0S - process 2 taps, 1 sample per channel (sample 0) */
|
||||
/* ; x = vb1 offset */
|
||||
.MACRO MC0S val_x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*(\val_x))]
|
||||
ldr VHI, [VB1, #(4*(23 - \val_x))]
|
||||
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
ldr VLO, [VB1, #(4*(32 + \val_x))]
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
ldr VHI, [VB1, #(4*(32 + 23 - \val_x))]
|
||||
|
||||
smlal SUM1RL, SUM1RH, VLO, CF1
|
||||
smlal SUM1RL, SUM1RH, VHI, CF2
|
||||
|
||||
.ENDM
|
||||
|
||||
/* ; MC1S - process 2 taps, 1 sample per channel (sample 16)
|
||||
; x = vb1 offset */
|
||||
.MACRO MC1S val_x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*(\val_x))]
|
||||
ldr VHI, [VB1, #(4*(32 + \val_x))]
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM1RL, SUM1RH, VHI, CF1
|
||||
|
||||
.ENDM
|
||||
|
||||
/* ; MC2S - process 2 taps, 2 samples per channel
|
||||
; x = vb1 offset */
|
||||
.MACRO MC2S val_x
|
||||
|
||||
/* ; load data as far as possible in advance of using it */
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*(\val_x))]
|
||||
ldr VHI, [VB1, #(4*(23 - \val_x))]
|
||||
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM2LL, SUM2LH, VLO, CF2
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM2LL, SUM2LH, VHI, CF1
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
|
||||
ldr VHI, [VB1, #(4*(32 + 23 - \val_x))]
|
||||
ldr VLO, [VB1, #(4*(32 + \val_x))]
|
||||
|
||||
smlal SUM1RL, SUM1RH, VHI, CF2
|
||||
smlal SUM2RL, SUM2RH, VHI, CF1
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1RL, SUM1RH, VLO, CF1
|
||||
smlal SUM2RL, SUM2RH, VLO, CF2
|
||||
.ENDM
|
||||
|
||||
|
||||
/* ; void PolyphaseStereo(short *pcm, int *vbuf, const int *coefBase) */
|
||||
.global xmp3_PolyphaseStereo
|
||||
.thumb_func
|
||||
xmp3_PolyphaseStereo:
|
||||
|
||||
stmfd sp!, {r4-r11, r14}
|
||||
|
||||
/* ; clear out stack space for 2 local variables (4 bytes each) */
|
||||
sub sp, sp, #8
|
||||
str PCM , [sp, #4] /*; sp[1] = pcm pointer */
|
||||
|
||||
/* ; special case, output sample 0 */
|
||||
mov SUM1LL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM1RL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM1LH, #0
|
||||
mov SUM1RH, #0
|
||||
|
||||
MC0S 0
|
||||
MC0S 1
|
||||
MC0S 2
|
||||
MC0S 3
|
||||
MC0S 4
|
||||
MC0S 5
|
||||
MC0S 6
|
||||
MC0S 7
|
||||
|
||||
ldr PCM, [sp, #4] /* ; load pcm pointer */
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM1RL, SUM1RH, SIGN, MAXPOS
|
||||
|
||||
strh SUM1LL, [PCM, #(2*0)]
|
||||
strh SUM1RL, [PCM, #(2*1)]
|
||||
|
||||
/* ; special case, output sample 16 */
|
||||
add COEF, COEF, #(4*(256-16)) /* ; coef = coefBase + 256 (was coefBase + 16 after MC0S block) */
|
||||
add VB1, VB1, #(4*1024) /* ; vb1 = vbuf + 64*16 */
|
||||
|
||||
mov SUM1LL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM1RL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM1LH, #0
|
||||
mov SUM1RH, #0
|
||||
|
||||
MC1S 0
|
||||
MC1S 1
|
||||
MC1S 2
|
||||
MC1S 3
|
||||
MC1S 4
|
||||
MC1S 5
|
||||
MC1S 6
|
||||
MC1S 7
|
||||
|
||||
ldr PCM, [sp, #4] /* load pcm pointer */
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM1RL, SUM1RH, SIGN, MAXPOS
|
||||
|
||||
strh SUM1LL, [PCM, #(2*(2*16+0))]
|
||||
strh SUM1RL, [PCM, #(2*(2*16+1))]
|
||||
|
||||
/*; main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17 */
|
||||
sub COEF, COEF, #(4*(264-16)) /* ; coef = coefBase + 16 (was coefBase + 264 after MC1S block) */
|
||||
sub VB1, VB1, #(4*(1024-64)) /* ; vb1 = vbuf + 64 (was vbuf + 64*16 after MC1S block) */
|
||||
mov I, #15 /* ; loop counter, count down */
|
||||
add PCM, PCM, #(2*2) /* ; pcm+=2 */
|
||||
|
||||
LoopPS:
|
||||
str I, [sp, #0] /* ; sp[0] = i (loop counter) */
|
||||
str PCM, [sp, #4] /* ; sp[1] = pcm (pointer to pcm buffer) */
|
||||
|
||||
mov SUM1LL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM1RL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM2LL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
mov SUM2RL, #RNDVAL /* ; load rndVal (low 32) */
|
||||
|
||||
mov SUM1LH, #0
|
||||
mov SUM1RH, #0
|
||||
mov SUM2LH, #0
|
||||
mov SUM2RH, #0
|
||||
|
||||
MC2S 0
|
||||
MC2S 1
|
||||
MC2S 2
|
||||
MC2S 3
|
||||
MC2S 4
|
||||
MC2S 5
|
||||
MC2S 6
|
||||
MC2S 7
|
||||
|
||||
add VB1, VB1, #(4*64) /*; vb1 += 64*/
|
||||
|
||||
ldr PCM, [sp, #4] /*; load pcm pointer*/
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM1RL, SUM1RH, SIGN, MAXPOS
|
||||
C64TOS SUM2LL, SUM2LH, SIGN, MAXPOS
|
||||
C64TOS SUM2RL, SUM2RH, SIGN, MAXPOS
|
||||
|
||||
ldr I, [sp, #0] /*; load loop counter*/
|
||||
add CF2, PCM, I, lsl #3 /*; CF2 = PCM + 4*i (short offset)*/
|
||||
strh SUM2LL, [CF2], #2 /*; *(pcm + 2*2*i + 0)*/
|
||||
strh SUM2RL, [CF2], #2 /*; *(pcm + 2*2*i + 1)*/
|
||||
|
||||
strh SUM1LL, [PCM], #2 /*; *(pcm + 0)*/
|
||||
strh SUM1RL, [PCM], #2 /*; *(pcm + 1)*/
|
||||
|
||||
subs I, I, #1
|
||||
bne LoopPS
|
||||
|
||||
/* ; restore stack pointer*/
|
||||
add sp, sp, #8
|
||||
|
||||
ldmfd sp!, {r4-r11, pc}
|
||||
/* ENDFUNC*/
|
||||
|
||||
/*;; MONO PROCESSING*/
|
||||
|
||||
/*; MC0M - process 2 taps, 1 sample (sample 0)*/
|
||||
/*; x = vb1 offset*/
|
||||
.MACRO MC0M val_x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*(\val_x))]
|
||||
ldr VHI, [VB1, #(4*(23 - \val_x))]
|
||||
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
|
||||
.endm
|
||||
/*MEND ; MC0M*/
|
||||
|
||||
/*; MC1M - process 2 taps, 1 sample (sample 16)*/
|
||||
/*; x = vb1 offset*/
|
||||
.MACRO MC1M val_x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*(\val_x))]
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
|
||||
.endm
|
||||
/*MEND ; MC1M*/
|
||||
|
||||
/* ; MC2M - process 2 taps, 2 samples*/
|
||||
/* ; x = vb1 offset*/
|
||||
.MACRO MC2M val_x
|
||||
|
||||
/* ; load data as far as possible in advance of using it*/
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*(\val_x))]
|
||||
ldr VHI, [VB1, #(4*(23 - \val_x))]
|
||||
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM2LL, SUM2LH, VLO, CF2
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
smlal SUM2LL, SUM2LH, VHI, CF1
|
||||
|
||||
.endm
|
||||
/*MEND ; MC2M*/
|
||||
|
||||
/*; void PolyphaseMono(short *pcm, int *vbuf, const int *coefBase)*/
|
||||
|
||||
.global xmp3_PolyphaseMono
|
||||
.thumb_func
|
||||
xmp3_PolyphaseMono:
|
||||
|
||||
stmfd sp!, {r4-r11, r14}
|
||||
|
||||
/*; clear out stack space for 4 local variables (4 bytes each)*/
|
||||
sub sp, sp, #8
|
||||
str PCM, [sp, #4] /*; sp[1] = pcm pointer*/
|
||||
|
||||
/* ; special case, output sample 0*/
|
||||
mov SUM1LL, #RNDVAL /* ; load rndVal (low 32)*/
|
||||
mov SUM1LH, #0
|
||||
|
||||
MC0M 0
|
||||
MC0M 1
|
||||
MC0M 2
|
||||
MC0M 3
|
||||
MC0M 4
|
||||
MC0M 5
|
||||
MC0M 6
|
||||
MC0M 7
|
||||
|
||||
ldr PCM, [sp, #4] /*; load pcm pointer*/
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
strh SUM1LL, [PCM, #(2*0)]
|
||||
|
||||
/* ; special case, output sample 16*/
|
||||
add COEF, COEF, #(4*(256-16)) /* ; coef = coefBase + 256 (was coefBase + 16 after MC0M block)*/
|
||||
add VB1, VB1, #(4*1024) /* ; vb1 = vbuf + 64*16*/
|
||||
|
||||
mov SUM1LL, #RNDVAL /* ; load rndVal (low 32)*/
|
||||
mov SUM1LH, #0
|
||||
|
||||
MC1M 0
|
||||
MC1M 1
|
||||
MC1M 2
|
||||
MC1M 3
|
||||
MC1M 4
|
||||
MC1M 5
|
||||
MC1M 6
|
||||
MC1M 7
|
||||
|
||||
ldr PCM, [sp, #4] /* ; load pcm pointer*/
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
|
||||
strh SUM1LL, [PCM, #(2*16)]
|
||||
|
||||
/* ; main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17*/
|
||||
sub COEF, COEF, #(4*(264-16)) /* ; coef = coefBase + 16 (was coefBase + 264 after MC1M block)*/
|
||||
sub VB1, VB1, #(4*(1024-64)) /* ; vb1 = vbuf + 64 (was vbuf + 64*16 after MC1M block)*/
|
||||
mov I, #15 /* ; loop counter, count down*/
|
||||
add PCM, PCM, #(2) /* ; pcm++*/
|
||||
|
||||
LoopPM:
|
||||
str I, [sp, #0] /* ; sp[0] = i (loop counter)*/
|
||||
str PCM, [sp, #4] /* ; sp[1] = pcm (pointer to pcm buffer)*/
|
||||
|
||||
mov SUM1LL, #RNDVAL /* ; load rndVal (low 32)*/
|
||||
mov SUM2LL, #RNDVAL /* ; load rndVal (low 32)*/
|
||||
mov SUM1LH, #0
|
||||
mov SUM2LH, #0
|
||||
|
||||
MC2M 0
|
||||
MC2M 1
|
||||
MC2M 2
|
||||
MC2M 3
|
||||
MC2M 4
|
||||
MC2M 5
|
||||
MC2M 6
|
||||
MC2M 7
|
||||
|
||||
add VB1, VB1, #(4*64) /*; vb1 += 64*/
|
||||
|
||||
ldr PCM, [sp, #4] /*; load pcm pointer*/
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM2LL, SUM2LH, SIGN, MAXPOS
|
||||
|
||||
ldr I, [sp, #0] /*; load loop counter*/
|
||||
add CF2, PCM, I, lsl #2 /*; CF2 = PCM + 2*i (short offset)*/
|
||||
strh SUM2LL, [CF2], #2 ; /**(pcm + 2*i + 0)*/
|
||||
strh SUM1LL, [PCM], #2 ; /**(pcm + 0) ; pcm++*/
|
||||
|
||||
subs I, I, #1
|
||||
bne LoopPM
|
||||
|
||||
/* ; restore stack pointer*/
|
||||
add sp, sp, #8
|
||||
|
||||
ldmfd sp!, {r4-r11, pc}
|
||||
|
||||
|
||||
.END
|
@@ -1,384 +0,0 @@
|
||||
AREA |.text|, CODE, READONLY, ALIGN=2
|
||||
THUMB
|
||||
REQUIRE8
|
||||
PRESERVE8
|
||||
|
||||
PCM RN r0
|
||||
VB1 RN r1
|
||||
COEF RN r2
|
||||
|
||||
VLO RN r0
|
||||
VHI RN r3
|
||||
|
||||
SUM1LL RN r4
|
||||
SUM1LH RN r5
|
||||
SUM2LL RN r6
|
||||
SUM2LH RN r7
|
||||
SUM1RL RN r8
|
||||
SUM1RH RN r9
|
||||
SUM2RL RN r10
|
||||
SUM2RH RN r11
|
||||
|
||||
CF1 RN r12
|
||||
CF2 RN r14
|
||||
|
||||
SIGN RN r12
|
||||
MAXPOS RN r14
|
||||
|
||||
I RN r12
|
||||
|
||||
GBLA RNDVAL
|
||||
RNDVAL SETA (1 << ((32 - 12) + (6 - 1)))
|
||||
|
||||
; C64TOS - clip 64-bit accumulator to short (no rounding)
|
||||
; xl, xh = value (lo 32, hi 32)
|
||||
; input assumed to have 6 fraction bits
|
||||
; sign = temp variable to use for sign
|
||||
; maxPos = 0x00007fff (takes 2 instr. to generate - calculating
|
||||
; once and using repeatedly saves if you do several CTOS in a row) */
|
||||
MACRO
|
||||
C64TOS $xl, $xh, $sign, $maxPos
|
||||
|
||||
mov $xl, $xl, lsr #(20+6)
|
||||
orr $xl, $xl, $xh, lsl #(12-6)
|
||||
mov $sign, $xl, ASR #31
|
||||
cmp $sign, $xl, ASR #15
|
||||
it ne
|
||||
eorne $xl, $sign, $maxPos
|
||||
MEND ; C64TOS
|
||||
|
||||
; MC0S - process 2 taps, 1 sample per channel (sample 0) */
|
||||
; x = vb1 offset */
|
||||
MACRO
|
||||
MC0S $x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*($x))]
|
||||
ldr VHI, [VB1, #(4*(23 - $x))]
|
||||
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
ldr VLO, [VB1, #(4*(32 + $x))]
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
ldr VHI, [VB1, #(4*(32 + 23 - $x))]
|
||||
|
||||
smlal SUM1RL, SUM1RH, VLO, CF1
|
||||
smlal SUM1RL, SUM1RH, VHI, CF2
|
||||
|
||||
MEND ; MCOS
|
||||
|
||||
; MC1S - process 2 taps, 1 sample per channel (sample 16)
|
||||
; x = vb1 offset
|
||||
MACRO
|
||||
MC1S $x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*($x))]
|
||||
ldr VHI, [VB1, #(4*(32 + $x))]
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM1RL, SUM1RH, VHI, CF1
|
||||
|
||||
MEND ; MC1S
|
||||
|
||||
; MC2S - process 2 taps, 2 samples per channel
|
||||
; x = vb1 offset
|
||||
MACRO
|
||||
MC2S $x
|
||||
|
||||
; load data as far as possible in advance of using it
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*($x))]
|
||||
ldr VHI, [VB1, #(4*(23 - $x))]
|
||||
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM2LL, SUM2LH, VLO, CF2
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM2LL, SUM2LH, VHI, CF1
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
|
||||
ldr VHI, [VB1, #(4*(32 + 23 - $x))]
|
||||
ldr VLO, [VB1, #(4*(32 + $x))]
|
||||
|
||||
smlal SUM1RL, SUM1RH, VHI, CF2
|
||||
smlal SUM2RL, SUM2RH, VHI, CF1
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1RL, SUM1RH, VLO, CF1
|
||||
smlal SUM2RL, SUM2RH, VLO, CF2
|
||||
|
||||
MEND ; MC2S
|
||||
|
||||
|
||||
; void PolyphaseStereo(short *pcm, int *vbuf, const int *coefBase)
|
||||
xmp3_PolyphaseStereo PROC
|
||||
EXPORT xmp3_PolyphaseStereo
|
||||
|
||||
stmfd sp!, {r4-r11, r14}
|
||||
|
||||
; clear out stack space for 2 local variables (4 bytes each)
|
||||
sub sp, sp, #8
|
||||
str PCM , [sp, #4] ; sp[1] = pcm pointer
|
||||
|
||||
; special case, output sample 0
|
||||
mov SUM1LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1RL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1LH, #0
|
||||
mov SUM1RH, #0
|
||||
|
||||
MC0S 0
|
||||
MC0S 1
|
||||
MC0S 2
|
||||
MC0S 3
|
||||
MC0S 4
|
||||
MC0S 5
|
||||
MC0S 6
|
||||
MC0S 7
|
||||
|
||||
ldr PCM, [sp, #4] ; load pcm pointer
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM1RL, SUM1RH, SIGN, MAXPOS
|
||||
|
||||
strh SUM1LL, [PCM, #(2*0)]
|
||||
strh SUM1RL, [PCM, #(2*1)]
|
||||
|
||||
; special case, output sample 16
|
||||
add COEF, COEF, #(4*(256-16)) ; coef = coefBase + 256 (was coefBase + 16 after MC0S block)
|
||||
add VB1, VB1, #(4*1024) ; vb1 = vbuf + 64*16
|
||||
|
||||
mov SUM1LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1RL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1LH, #0
|
||||
mov SUM1RH, #0
|
||||
|
||||
MC1S 0
|
||||
MC1S 1
|
||||
MC1S 2
|
||||
MC1S 3
|
||||
MC1S 4
|
||||
MC1S 5
|
||||
MC1S 6
|
||||
MC1S 7
|
||||
|
||||
ldr PCM, [sp, #4] ; load pcm pointer
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM1RL, SUM1RH, SIGN, MAXPOS
|
||||
|
||||
strh SUM1LL, [PCM, #(2*(2*16+0))]
|
||||
strh SUM1RL, [PCM, #(2*(2*16+1))]
|
||||
|
||||
; main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17
|
||||
sub COEF, COEF, #(4*(264-16)) ; coef = coefBase + 16 (was coefBase + 264 after MC1S block)
|
||||
sub VB1, VB1, #(4*(1024-64)) ; vb1 = vbuf + 64 (was vbuf + 64*16 after MC1S block)
|
||||
mov I, #15 ; loop counter, count down
|
||||
add PCM, PCM, #(2*2) ; pcm+=2
|
||||
|
||||
LoopPS
|
||||
str I, [sp, #0] ; sp[0] = i (loop counter)
|
||||
str PCM, [sp, #4] ; sp[1] = pcm (pointer to pcm buffer)
|
||||
|
||||
mov SUM1LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1RL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM2LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM2RL, #RNDVAL ; load rndVal (low 32)
|
||||
|
||||
mov SUM1LH, #0
|
||||
mov SUM1RH, #0
|
||||
mov SUM2LH, #0
|
||||
mov SUM2RH, #0
|
||||
|
||||
MC2S 0
|
||||
MC2S 1
|
||||
MC2S 2
|
||||
MC2S 3
|
||||
MC2S 4
|
||||
MC2S 5
|
||||
MC2S 6
|
||||
MC2S 7
|
||||
|
||||
add VB1, VB1, #(4*64) ; vb1 += 64
|
||||
|
||||
ldr PCM, [sp, #4] ; load pcm pointer
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM1RL, SUM1RH, SIGN, MAXPOS
|
||||
C64TOS SUM2LL, SUM2LH, SIGN, MAXPOS
|
||||
C64TOS SUM2RL, SUM2RH, SIGN, MAXPOS
|
||||
|
||||
ldr I, [sp, #0] ; load loop counter
|
||||
add CF2, PCM, I, lsl #3 ; CF2 = PCM + 4*i (short offset)
|
||||
strh SUM2LL, [CF2], #2 ; *(pcm + 2*2*i + 0)
|
||||
strh SUM2RL, [CF2], #2 ; *(pcm + 2*2*i + 1)
|
||||
|
||||
strh SUM1LL, [PCM], #2 ; *(pcm + 0)
|
||||
strh SUM1RL, [PCM], #2 ; *(pcm + 1)
|
||||
|
||||
subs I, I, #1
|
||||
bne LoopPS
|
||||
|
||||
; restore stack pointer
|
||||
add sp, sp, #8
|
||||
|
||||
ldmfd sp!, {r4-r11, pc}
|
||||
|
||||
ENDP
|
||||
|
||||
; MONO PROCESSING
|
||||
|
||||
; MC0M - process 2 taps, 1 sample (sample 0)
|
||||
; x = vb1 offset
|
||||
MACRO
|
||||
MC0M $x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*($x))]
|
||||
ldr VHI, [VB1, #(4*(23 - $x))]
|
||||
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
|
||||
MEND ; MC0M
|
||||
|
||||
; MC1M - process 2 taps, 1 sample (sample 16)
|
||||
; x = vb1 offset
|
||||
MACRO
|
||||
MC1M $x
|
||||
|
||||
ldr CF1, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*($x))]
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
|
||||
MEND ; MC1M
|
||||
|
||||
; MC2M - process 2 taps, 2 samples
|
||||
; x = vb1 offset
|
||||
MACRO
|
||||
MC2M $x
|
||||
|
||||
; load data as far as possible in advance of using it
|
||||
ldr CF1, [COEF], #4
|
||||
ldr CF2, [COEF], #4
|
||||
ldr VLO, [VB1, #(4*($x))]
|
||||
ldr VHI, [VB1, #(4*(23 - $x))]
|
||||
|
||||
smlal SUM1LL, SUM1LH, VLO, CF1
|
||||
smlal SUM2LL, SUM2LH, VLO, CF2
|
||||
rsb CF2, CF2, #0
|
||||
smlal SUM1LL, SUM1LH, VHI, CF2
|
||||
smlal SUM2LL, SUM2LH, VHI, CF1
|
||||
|
||||
MEND ; MC2M
|
||||
|
||||
; void PolyphaseMono(short *pcm, int *vbuf, const int *coefBase)
|
||||
|
||||
xmp3_PolyphaseMono PROC
|
||||
EXPORT xmp3_PolyphaseMono
|
||||
|
||||
stmfd sp!, {r4-r11, r14}
|
||||
|
||||
; clear out stack space for 4 local variables (4 bytes each)
|
||||
sub sp, sp, #8
|
||||
str PCM, [sp, #4] ; sp[1] = pcm pointer
|
||||
|
||||
; special case, output sample 0
|
||||
mov SUM1LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1LH, #0
|
||||
|
||||
MC0M 0
|
||||
MC0M 1
|
||||
MC0M 2
|
||||
MC0M 3
|
||||
MC0M 4
|
||||
MC0M 5
|
||||
MC0M 6
|
||||
MC0M 7
|
||||
|
||||
ldr PCM, [sp, #4] ; load pcm pointer
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
strh SUM1LL, [PCM, #(2*0)]
|
||||
|
||||
; special case, output sample 16
|
||||
add COEF, COEF, #(4*(256-16)) ; coef = coefBase + 256 (was coefBase + 16 after MC0M block)
|
||||
add VB1, VB1, #(4*1024) ; vb1 = vbuf + 64*16
|
||||
|
||||
mov SUM1LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1LH, #0
|
||||
|
||||
MC1M 0
|
||||
MC1M 1
|
||||
MC1M 2
|
||||
MC1M 3
|
||||
MC1M 4
|
||||
MC1M 5
|
||||
MC1M 6
|
||||
MC1M 7
|
||||
|
||||
ldr PCM, [sp, #4] ; load pcm pointer
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
|
||||
strh SUM1LL, [PCM, #(2*16)]
|
||||
|
||||
; main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17
|
||||
sub COEF, COEF, #(4*(264-16)) ; coef = coefBase + 16 (was coefBase + 264 after MC1M block)
|
||||
sub VB1, VB1, #(4*(1024-64)) ; vb1 = vbuf + 64 (was vbuf + 64*16 after MC1M block)
|
||||
mov I, #15 ; loop counter, count down
|
||||
add PCM, PCM, #(2) ; pcm++
|
||||
|
||||
LoopPM
|
||||
str I, [sp, #0] ; sp[0] = i (loop counter)
|
||||
str PCM, [sp, #4] ; sp[1] = pcm (pointer to pcm buffer)
|
||||
|
||||
mov SUM1LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM2LL, #RNDVAL ; load rndVal (low 32)
|
||||
mov SUM1LH, #0
|
||||
mov SUM2LH, #0
|
||||
|
||||
MC2M 0
|
||||
MC2M 1
|
||||
MC2M 2
|
||||
MC2M 3
|
||||
MC2M 4
|
||||
MC2M 5
|
||||
MC2M 6
|
||||
MC2M 7
|
||||
|
||||
add VB1, VB1, #(4*64) ; vb1 += 64
|
||||
|
||||
ldr PCM, [sp, #4] ; load pcm pointer
|
||||
mov MAXPOS, #0x7f00
|
||||
orr MAXPOS, MAXPOS, #0xff
|
||||
|
||||
C64TOS SUM1LL, SUM1LH, SIGN, MAXPOS
|
||||
C64TOS SUM2LL, SUM2LH, SIGN, MAXPOS
|
||||
|
||||
ldr I, [sp, #0] ; load loop counter*/
|
||||
add CF2, PCM, I, lsl #2 ; CF2 = PCM + 2*i (short offset)*/
|
||||
strh SUM2LL, [CF2], #2 ; (pcm + 2*i + 0)
|
||||
strh SUM1LL, [PCM], #2 ; (pcm + 0) ; pcm++
|
||||
|
||||
subs I, I, #1
|
||||
bne LoopPM
|
||||
|
||||
; restore stack pointer
|
||||
add sp, sp, #8
|
||||
|
||||
ldmfd sp!, {r4-r11, pc}
|
||||
ENDP
|
||||
|
||||
END
|
@@ -6,8 +6,8 @@
|
||||
|
||||
|
||||
|
||||
extern const unsigned int Load$$bsp_init$$Base;
|
||||
extern const unsigned int Load$$bsp_init$$Limit;
|
||||
extern const unsigned int bsp_init_start;
|
||||
extern const unsigned int bsp_init_end;
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ extern const unsigned int Load$$bsp_init$$Limit;
|
||||
// 初始化所有外设
|
||||
int bsp_init_all(void)
|
||||
{
|
||||
init_call_fun *start=(init_call_fun *)&Load$$bsp_init$$Base;
|
||||
init_call_fun *end=(init_call_fun *)&Load$$bsp_init$$Limit;
|
||||
init_call_fun *start=(init_call_fun *)&bsp_init_start;
|
||||
init_call_fun *end=(init_call_fun *)&bsp_init_end;
|
||||
|
||||
int ret=0;
|
||||
init_call_fun *ptr=0;
|
||||
|
92
Project/Src/MY/syscalls.c
Normal file
92
Project/Src/MY/syscalls.c
Normal file
@@ -0,0 +1,92 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include "sys/stat.h"
|
||||
#include "reent.h"
|
||||
|
||||
int _close(int fd) {
|
||||
(void)fd;
|
||||
return -1; // 不支持文件操作
|
||||
}
|
||||
|
||||
int _read(int fd, char *buf, int nbytes) {
|
||||
(void)fd; (void)buf; (void)nbytes;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _write(int fd, const char *buf, int nbytes) {
|
||||
(void)fd; (void)buf; (void)nbytes;
|
||||
return -1;
|
||||
}
|
||||
|
||||
off_t _lseek(int fd, off_t offset, int whence) {
|
||||
(void)fd; (void)offset; (void)whence;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _isatty(int fd) {
|
||||
(void)fd;
|
||||
return 1; // 假设是终端设备
|
||||
}
|
||||
|
||||
int _open(const char *path, int flags, ...) {
|
||||
(void)path; (void)flags;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _fstat(int fd, struct stat *st) {
|
||||
(void)fd; (void)st;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _stat(const char *path, struct stat *st) {
|
||||
(void)path; (void)st;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _unlink(const char *name) {
|
||||
(void)name;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _link(const char *old, const char *new) {
|
||||
(void)old; (void)new;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _execve(const char *name, char *const *argv, char *const *env) {
|
||||
(void)name; (void)argv; (void)env;
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _fork(void) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _getpid(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _wait(int *status) {
|
||||
(void)status;
|
||||
errno = ECHILD;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _times(struct tms *buf) {
|
||||
(void)buf;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int _kill(int pid, int sig) {
|
||||
(void)pid; (void)sig;
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *_sbrk(ptrdiff_t incr) {
|
||||
(void)incr;
|
||||
errno = ENOMEM;
|
||||
return (void *)-1;
|
||||
}
|
@@ -4,21 +4,19 @@
|
||||
|
||||
|
||||
|
||||
|
||||
__ASM void *get_r9(void)
|
||||
{
|
||||
mov r0,r9
|
||||
bx lr
|
||||
void *get_r9(void) {
|
||||
void *r0;
|
||||
__asm volatile (
|
||||
"MOV %0, r9" : "=r" (r0)
|
||||
);
|
||||
return r0;
|
||||
}
|
||||
|
||||
__ASM void set_r9(void *r9)
|
||||
{
|
||||
mov r9 ,r0
|
||||
bx lr
|
||||
void set_r9(void *r9) {
|
||||
__asm volatile (
|
||||
"MOV r9, %0" : : "r" (r9)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -14,7 +14,7 @@ void SysFile_Updata(char *FileName,char *FilePath)
|
||||
FIL *file_fil=mymalloc (sizeof(FIL));
|
||||
u8 *file_mem=mymalloc(4096);
|
||||
u32 read_size=0;
|
||||
u32 real_size=0;
|
||||
UINT real_size=0;
|
||||
u32 read_size_left=0;
|
||||
u32 flash_write_addr=FLASH_GetUsed();
|
||||
ret=f_stat (FilePath,file_info);
|
||||
@@ -204,7 +204,7 @@ void SysFile_UpdataByCom (void)
|
||||
else
|
||||
{ real=0;}
|
||||
mymemset (ret,t,5);
|
||||
usb_sendData(ret,5);
|
||||
// usb_sendData(ret,5);
|
||||
if (updata->step==0x04) break;//数据传输完成
|
||||
}
|
||||
}
|
||||
|
@@ -199,7 +199,7 @@ typedef struct{
|
||||
|
||||
static stdout_file *g_stdout_file;
|
||||
|
||||
static int open(void)
|
||||
static int topen(void)
|
||||
{
|
||||
stdout_file *file=g_stdout_file;
|
||||
if(file==NULL)
|
||||
@@ -211,7 +211,7 @@ static int open(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int close(void)
|
||||
static int tclose(void)
|
||||
{
|
||||
stdout_file **file=&g_stdout_file;
|
||||
if(*file)
|
||||
@@ -308,7 +308,7 @@ static int puts_(const void *ptr,int size)
|
||||
return size;
|
||||
}
|
||||
|
||||
extern_device2(lcd,open,close,put,NULL,puts_,NULL);
|
||||
extern_device2(lcd,topen,tclose,put,NULL,puts_,NULL);
|
||||
|
||||
|
||||
// 绘制调试信息到屏幕
|
||||
|
@@ -219,7 +219,7 @@ static int cb_run_lua(void *ptr)
|
||||
(char *)ptr,
|
||||
};
|
||||
|
||||
lua_main(2,argv);
|
||||
// lua_main(2,argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -350,7 +350,7 @@ void FILDER_OpenFile (WIN_FilderStruct *filder)
|
||||
{
|
||||
FILDER_GetFileRoute(filder);
|
||||
WIN_KeyShieldOn();
|
||||
nes_load ((u8*)filder->fileName,LCD_GetShowAddr(),LCD_GetLcdSizeX()/2-128,LCD_GetLcdSizeY()/2-120);
|
||||
// nes_load ((u8*)filder->fileName,LCD_GetShowAddr(),LCD_GetLcdSizeX()/2-128,LCD_GetLcdSizeY()/2-120);
|
||||
WIN_KeyShieldOff();
|
||||
|
||||
}
|
||||
|
@@ -107,7 +107,9 @@ PendSV_Handler:
|
||||
|
||||
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
||||
TST lr, #0x10 /* if(!EXC_RETURN[4]) */
|
||||
ITE EQ /* IT block for FPU instructions */
|
||||
VSTMDBEQ r1!, {d8 - d15} /* push FPU register s16~s31 */
|
||||
VSTMDBNE r1!, {d8 - d15} /* optional: if needed for NE case */
|
||||
#endif
|
||||
|
||||
STMFD r1!, {r4 - r11} /* push r4 - r11 register */
|
||||
@@ -116,7 +118,9 @@ PendSV_Handler:
|
||||
MOV r4, #0x00 /* flag = 0 */
|
||||
|
||||
TST lr, #0x10 /* if(!EXC_RETURN[4]) */
|
||||
MOVEQ r4, #0x01 /* flag = 1 */
|
||||
ITE EQ /* IT block for conditional moves */
|
||||
MOVEQ r4, #0x01 /* flag = 1 if FPU was used */
|
||||
MOVNE r4, #0x00 /* flag = 0 otherwise */
|
||||
|
||||
STMFD r1!, {r4} /* push flag */
|
||||
#endif
|
||||
@@ -137,15 +141,18 @@ switch_to_thread:
|
||||
|
||||
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
||||
CMP r3, #0 /* if(flag_r3 != 0) */
|
||||
VLDMIANE r1!, {d8 - d15} /* pop FPU register s16~s31 */
|
||||
ITE EQ /* IT block for FPU instructions */
|
||||
VLDMIAEQ r1!, {d8 - d15} /* pop FPU register s16~s31 */
|
||||
VLDMIANE r1!, {d8 - d15} /* optional: if needed for NE case */
|
||||
#endif
|
||||
|
||||
MSR psp, r1 /* update stack pointer */
|
||||
|
||||
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
||||
ORR lr, lr, #0x10 /* lr |= (1 << 4), clean FPCA. */
|
||||
ORR lr, lr, #0x10 /* lr |= (1 << 4), clean FPCA */
|
||||
CMP r3, #0 /* if(flag_r3 != 0) */
|
||||
BICNE lr, lr, #0x10 /* lr &= ~(1 << 4), set FPCA. */
|
||||
IT NE /* IT block for BICNE */
|
||||
BICNE lr, lr, #0x10 /* lr &= ~(1 << 4), set FPCA */
|
||||
#endif
|
||||
|
||||
pendsv_exit:
|
||||
|
@@ -40,6 +40,8 @@ DEF=[
|
||||
]
|
||||
|
||||
INC=[
|
||||
'-ISrc/MJPEG',
|
||||
'-ISrc/MJPEG/JPEG',
|
||||
'-ISrc/STM32/CMSIS/Device/ST/STM32F4xx/Include',
|
||||
'-ISrc/STM32/CMSIS/Include',
|
||||
'-ISrc/STM32/DSP/Include',
|
||||
@@ -54,8 +56,6 @@ INC=[
|
||||
'-ISrc/lpng1637',
|
||||
'-ISrc/lua-5.4.2',
|
||||
'-ISrc/lua-5.4.2/src',
|
||||
'-ISrc/MJPEG',
|
||||
'-ISrc/MJPEG/JPEG',
|
||||
'-ISrc/MP3',
|
||||
'-ISrc/MP3/helix',
|
||||
'-ISrc/MY',
|
||||
@@ -71,14 +71,13 @@ INC=[
|
||||
]
|
||||
|
||||
SRC_DIR=[
|
||||
'Src/MJPEG',
|
||||
'Src/STM32/STM32F4xx_StdPeriph_Driver/src',
|
||||
'Src/Drive/Source',
|
||||
'Src/FreeType/src',
|
||||
'Src/JPEG',
|
||||
'Src/lib',
|
||||
'Src/lpng1637',
|
||||
'Src/lua-5.4.2/src',
|
||||
'Src/MJPEG',
|
||||
# 'Src/lua-5.4.2/src',
|
||||
'Src/MP3',
|
||||
'Src/MyApp',
|
||||
'Src/MyWin',
|
||||
@@ -89,6 +88,7 @@ SRC_DIR=[
|
||||
|
||||
SRC=[
|
||||
'Src/STM32/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc_ride7/startup_stm32f429_439xx.s',
|
||||
'Src/STM32/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c',
|
||||
"Src/MY/bsp_init.c",
|
||||
"Src/MY/main_my.c",
|
||||
"Src/MY/stm32f4xx_it.c",
|
||||
@@ -98,13 +98,32 @@ SRC=[
|
||||
'Src/FATS/ff.c',
|
||||
'Src/FATS/ffsystem.c',
|
||||
'Src/FATS/mycc936.c',
|
||||
"Src/lib/buff.c",
|
||||
'Src/rt-thread/board.c',
|
||||
# 'Src/rt-thread/core_delay.c',
|
||||
'Src/rt-thread/libcpu/arm/cortex-m4/context_gcc.S',
|
||||
'Src/rt-thread/ports/cpuport.c',
|
||||
'Src/FreeType/ftdebug.c',
|
||||
'Src/FreeType/ftfile.c',
|
||||
|
||||
|
||||
|
||||
'Src/zlib/adler32.c',
|
||||
'Src/zlib/compress.c',
|
||||
'Src/zlib/crc32.c',
|
||||
'Src/zlib/deflate.c',
|
||||
# 'Src/zlib/gzclose.c',
|
||||
# 'Src/zlib/gzlib.c',
|
||||
# 'Src/zlib/gzread.c',
|
||||
# 'Src/zlib/gzwrite.c',
|
||||
'Src/zlib/infback.c',
|
||||
'Src/zlib/inffast.c',
|
||||
'Src/zlib/inflate.c',
|
||||
'Src/zlib/inftrees.c',
|
||||
'Src/zlib/trees.c',
|
||||
'Src/zlib/uncompr.c',
|
||||
'Src/zlib/zutil.c',
|
||||
'Src/MP3/helix/arm/asmmisc_gcc.s',
|
||||
'Src/MP3/helix/arm/asmpoly_thumb2_gcc.s',
|
||||
'Src/MY/syscalls.c',
|
||||
]
|
||||
|
||||
LD_FILE="stm32f429ighx_flash.ld"
|
||||
@@ -180,7 +199,7 @@ def run_cmd(cmd_queue:Queue,cpu_index:int,return_list:Queue,failed_num):
|
||||
print(f"[{cpu_index}] {cmd.info}")
|
||||
# ret=os.system(cmd.cmd)
|
||||
try:
|
||||
ret = subprocess.run(cmd.cmd, shell=True, timeout=20).returncode
|
||||
ret = subprocess.run(cmd.cmd, shell=True, timeout=60).returncode
|
||||
except subprocess.TimeoutExpired:
|
||||
print("命令执行超时!")
|
||||
failed_num.value += 1
|
||||
@@ -193,7 +212,7 @@ def run_cmd(cmd_queue:Queue,cpu_index:int,return_list:Queue,failed_num):
|
||||
return_list.put((cpu_index,ack))
|
||||
|
||||
|
||||
def run_cmd_queue(cmd_queue:Queue,cpu_num:int=cpu_count()):
|
||||
def run_cmd_queue(cmd_queue:Queue,cpu_num:int=8):
|
||||
if(cmd_queue.empty()):
|
||||
return True
|
||||
process_list = []
|
||||
@@ -279,11 +298,13 @@ def build_target(src:list):
|
||||
obj_list.append('.'.join([name,'o']))
|
||||
dst=os.path.join(OUTPUT,TARGET)+".elf"
|
||||
if(check_rebuild(dst,obj_list)):
|
||||
cmd=f"{CC} {' '.join(obj_list)} -o {dst} {flags} -specs=nano.specs \
|
||||
rsp=f"{' '.join(obj_list)} -o {dst} {flags} -specs=nano.specs \
|
||||
-T{LD_FILE} -lc -lm -lnosys -Wl,-Map={OUTPUT}/{TARGET}.map,--cref -Wl,--gc-sections \
|
||||
-Wl,--no-warn-rwx-segments -Wl,-print-memory-usage"
|
||||
print(f"链接 {dst}")
|
||||
ret=os.system(cmd)
|
||||
with open(f"{OUTPUT}/{TARGET}.rsp",'w+') as f:
|
||||
f.write(rsp.replace('\\','/'))
|
||||
ret=os.system(f"{CC} @{OUTPUT}/{TARGET}.rsp")
|
||||
return ret==0
|
||||
return False
|
||||
|
||||
@@ -312,3 +333,5 @@ if __name__ == "__main__":
|
||||
main()
|
||||
tick_end=time.time()
|
||||
print(f"cost: {tick_end-tick_start}")
|
||||
# for item in find_type('Src/zlib',".c"):
|
||||
# print(f"'{item}',".replace('\\','/'))
|
||||
|
@@ -103,6 +103,27 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.my_data :
|
||||
{
|
||||
/* Place specific object files at fixed addresses */
|
||||
. = ALIGN(4);
|
||||
libc_dev_start = .;
|
||||
*(libc_dev)
|
||||
libc_dev_end = .;
|
||||
. = ALIGN(4);
|
||||
name_start = .;
|
||||
*(name)
|
||||
name_end = .;
|
||||
. = ALIGN(4);
|
||||
sys_api_start = .;
|
||||
*(sys_api)
|
||||
sys_api_end = .;
|
||||
. = ALIGN(4);
|
||||
bsp_init_start = .;
|
||||
*(bsp_init)
|
||||
bsp_init_end = .;
|
||||
} >FLASH
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
@@ -131,6 +152,7 @@ SECTIONS
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = LOADADDR(.data);
|
||||
|
||||
|
Reference in New Issue
Block a user