2012-05-31 11:16 AM
I successfully compiled the stm3240g Sample Project using Code Sourcery.
But, it does nothing on the Discovery Board.But, this code is directly converted from as WORKING Code on the Discovery Board
- when compiled with Atollic Compiler.-> Why should the Code not run successfully if it compiles by the Code Sourcery too ??
What could cause this problem - difference ? Would WinArm work any better ?2012-06-10 09:04 PM
STARTUP.S:
//////////////////////// /* +=============================================================================+ | includes +=============================================================================+ */#include ''hdr/hdr_special_registers.h''
/*
+=============================================================================+ | ARMv7-M(E) (Cortex-M3 / Cortex-M4) startup code +=============================================================================+ */.text
.balign 2 .syntax unified .thumb .thumb_func .global Reset_HandlerReset_Handler:
/*
+-----------------------------------------------------------------------------+ | Initialize the process stack pointer +-----------------------------------------------------------------------------+ */ldr r0, =__process_stack_end
msr PSP, r0/*
+-----------------------------------------------------------------------------+ | Thread mode uses process stack (PSP) and is privileged +-----------------------------------------------------------------------------+ */movs r0, #CONTROL_ALTERNATE_STACK
msr CONTROL, r0 isb/*
+-----------------------------------------------------------------------------+ | Branch to low_level_init_0() function (.data and .bss are not initialized!) +-----------------------------------------------------------------------------+ */ldr r0, =low_level_init_0
blx r0/*
+-----------------------------------------------------------------------------+ | Initialize .data section +-----------------------------------------------------------------------------+ */ldr r1, =__data_init_start
ldr r2, =__data_start ldr r3, =__data_end1: cmp r2, r3
ittt lo ldrlo r0, [r1], #4 strlo r0, [r2], #4 blo 1b/*
+-----------------------------------------------------------------------------+ | Zero-init .bss section +-----------------------------------------------------------------------------+ */movs r0, #0
ldr r1, =__bss_start ldr r2, =__bss_end1: cmp r1, r2
itt lo strlo r0, [r1], #4 blo 1b/*
| Call the clock system intitialization function. */ /* bl SystemInit */ ldr r0, =SystemInit blx r0/*
+-----------------------------------------------------------------------------+ | Call C++ constructors for global and static objects +-----------------------------------------------------------------------------+ */ #ifdef __USES_CXX ldr r0, =__libc_init_array blx r0 #endif/*
+-----------------------------------------------------------------------------+ | Branch to low_level_init_1() function +-----------------------------------------------------------------------------+ */ldr r0, =low_level_init_1
blx r0/*
+-----------------------------------------------------------------------------+ | Branch to main() with link +-----------------------------------------------------------------------------+ */ldr r0, =main
blx r0/*
+-----------------------------------------------------------------------------+ | Call C++ destructors for global and static objects +-----------------------------------------------------------------------------+ */ #ifdef __USES_CXX ldr r0, =__libc_fini_array blx r0 #endif/*
+-----------------------------------------------------------------------------+ | On return - loop till the end of the world +-----------------------------------------------------------------------------+ */b .
/*
+=============================================================================+ | __default_low_level_init() - replacement for undefined low_level_init_0() | and/or low_level_init_1(). This function just returns. +=============================================================================+ */.text
.balign 2 .syntax unified .thumb .thumb_func .global __default_low_level_init__default_low_level_init:
bx lr/*
+=============================================================================+ | assign undefined low_level_init_0() and/or low_level_init_1() to | __default_low_level_init() +=============================================================================+ */.weak low_level_init_0
.global low_level_init_0 .set low_level_init_0, __default_low_level_init.weak low_level_init_1
.global low_level_init_1 .set low_level_init_1, __default_low_level_init/******************************************************************************
* END OF FILE ******************************************************************************/2012-06-10 09:07 PM
2012-06-10 10:43 PM
* Is there some Fuse Setting that I need to program into the Chip for the Clock ?
2012-06-11 04:03 AM
Hi,
Just a background fact. I've been using CodeSourcery G++ with Eclipse for quite a some time and happy with it. Before that I used KeilMDK and IAR, and the outstanding Eclipse IDE makes the coding lot more easier. I'm using Eclipse CDT with Cross Compiler Support. The CDT internal builder is used, as such the makefile is not needed. Moreover, Atolics startup and linker descriptions can be used straight away, to start Hello World! I even used Scons instead of make, and happy with it too.2012-06-11 01:41 PM
Clive,
Any ideas from the code ?2012-06-11 02:30 PM
Clive, Any ideas from the code ?
I seem to be missing a lot of the pieces (zipping up a complete buildable project might help, bit it is rather a mess), and you seem to have created rather a hybrid environment mixing the standard library code with a lot of other stuff which I don't have any visibility to. I'm not sure why that was necessary as the standard library is serviceable. I've been using GCC with pretty the stock library and example code and customize linker script based on the STM32F1 version I used, Lanchon's I think. And the Ride startup code. What USART are you outputting data too, and does the baud rate match expectations? If the data is garbled it's a pretty good indicator that the hardware and software have different ideas about what the clock rates/settings are.2012-06-11 02:39 PM
I can only assume the problem is in the makefile or startup.S
Or low_level_init_0, low_level_init_1 or SystemInit Other functions work back the PLL settings, and HSE_VALUE. Another potential is that it's using HSI (16 MHz) vs HSE (8 MHz), you could direct the clocks out the MCO pins and measure it with a scope to confirm it's what you expect.2012-06-11 09:24 PM
clive,
Sorry about looking messy. This is the result of dropping my working Port of stm3240g into a BlinkLed Project for Code Sourcery. I have not been able to get noticable executable code from Code Sourcery before this. The Usart is not enabled. The Startup is the Blink Led Startup - not from stm3240g, but it is calling the stm3240g clock startup. This is running on the Stm32f4Discovery Board. As I said for speed, the Heartbeat Led is twice as slow, the Beeps are lower in Pitch, and the usb is not working - so I think that is already clear as a problem. Let me try to put together a zip then. Try this zip:2012-06-12 02:16 PM
You should be able to attach things here.
Missing fonts.h, pulled from another STM32 library Missing chip.h, fudged some code for STAT_P Builds with Yagarto GCC 4.6.2 Want to attach your out directory from Code Sourcery? Mine expired, not hot to do a reinstall or buy a license.2012-06-12 07:29 PM
//// CHIP.H ////
#ifndefCHIP_H
#defineCHIP_H1#include ''stm32f4xx.h''
extern intCPU_MODE_ST;
extern GPIO_TypeDef *STAT_P;
extern intSTAT_B; #endif ________________ Attachments : out.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzYn&d=%2Fa%2F0X0000000bNd%2FDP9omEPT_NZ4zh1Sv_wyWd1HtNhIK89A7dfKXJ.VKto&asPdf=false