File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
product-mini/platforms/rt-thread Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,10 @@ cwd = GetCurrentDir()
1313
1414src = Glob ('*.c' )
1515
16- if rtconfig .ARCH == 'arm' :
17- if re .match ('^cortex-m.*' , rtconfig .CPU ):
18- src += ['arch/invokeNative_thumb.s' ]
19- elif re .match ('^cortex-a.*' , rtconfig .CPU ):
20- src += ['arch/invokeNative_arm.s' ]
21- elif rtconfig .ARCH == 'ia32' :
22- src += ['arch/invokeNative_ia32.s' ]
16+ if rtconfig .ARCH == 'arm' and re .match ('^cortex-m.*' , rtconfig .CPU ):
17+ src += ['arch/invokeNative_thumb.s' ]
18+ else :
19+ src .append (f"arch/invokeNative_{ rtconfig .ARCH } .s" )
2320
2421CPPPATH = [cwd , cwd + '/../include' ]
2522
Original file line number Diff line number Diff line change @@ -192,6 +192,21 @@ my_read_file_to_buffer(char *filename, rt_uint32_t *size)
192192{
193193 struct stat f_stat ;
194194
195+ if (!filename || !size ) {
196+ rt_set_errno (- EINVAL );
197+ return RT_NULL ;
198+ }
199+
200+ if (stat (filename , & f_stat ) != 0 ) {
201+ rt_set_errno (errno );
202+ return RT_NULL ;
203+ }
204+
205+ if (f_stat .st_size <= 0 ) {
206+ rt_set_errno (- EINVAL );
207+ return RT_NULL ;
208+ }
209+
195210 rt_uint8_t * buff = rt_malloc (f_stat .st_size );
196211 * size = 0 ;
197212 if (!buff ) {
You can’t perform that action at this time.
0 commit comments