Jump to content
Sign in to follow this  
chicken

Code Composer Studio v6 now officially released

Recommended Posts

Hi, Spirilis. I have the same problems you have solved regarding using FAR_ROM with the MSP430x5x family (a MSP43F5438 in my case).

Started with a working program (less than 64Kb) and tried relocating code to FAR_ROM defining a ".far_text" section at "ld" file (just a copy of .text section, deleting .lowtext  and using > FAR_ROM instead of ROM >). Then I put an "__attribute__((section(".far_text"))) " to a function, and built the code. Inmmediately I found the above "relocation truncated to fit: R_MSP430X_ABS16 against symbol" message.

Then I tried defining -mlarge flag at "Properties > CCS Build > GNU Compiler > Miscellaneous>Other", and also at "Properties > CCS Build > GNU Linker > Miscellaneous>Other flags".... no way --> "region 'ROM' overflowed by 2744 bytes"...

But also,  if I delete the __attribute__((section(".far_text"))) " so I'm using the original code allocation (which worked at first) now it doen's work!!! I need to remove trhe -mlarge flags to make it work again...!!!

So -mlarge flags are totally messing up my code allocation...(even with a "small" program)

 

FYI, I've also defined symbols "__MSPF4305438__", "GCC_MSP430X", and "__LARGE_DATA_MODEL__" at my "Compiler section"...

Could you help me to find what is happening?

(Perhaps a copy of one of your "projects", using FAR_ROM memory, could be a help...)

Thanks in advance!

 

 

PS. I have no .highmem section at my ld file

Share this post


Link to post
Share on other sites

 

Fwiw, I did a basic program targeting the msp430f5438a and had no problems.

 

I added this to the very END of the linker script, before the final } (closing brace)-

  .highmem :
  {
    . = ALIGN(2);
    *(.far_text)
  } > FAR_ROM

Then a basic main.c:

/*
 * main.c
 */
#include <msp430.h>

int main(void) {
	WDTCTL = WDTPW | WDTHOLD;

	P1DIR |= BIT0;
	P1OUT = 0;
	
	while(1) {
		test_function();
		P1OUT ^= BIT0;
		__delay_cycles(800000);
	}
	return 0;
}

__attribute__((section(".far_text")))
void test_function()
{
	P1REN ^= BIT0;
}

Gave me the relocation error at first, then I added -mlarge only to the Properties > Build > GNU Compiler > Miscellaneous, and compiled with success.

CCS build messages:


**** Build of configuration Debug for project hightest ****

"c:\\ti\\ccsv6\\utils\\bin\\gmake" -k all 
'Building file: ../main.c'
'Invoking: GNU Compiler'
"c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/bin/msp430-elf-gcc.exe" -c -mmcu=msp430f5438a -I"c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/msp430-elf/include" -I"c:/ti/ccsv6/ccs_base/msp430/include_gcc" -Os -g -gstrict-dwarf -Wall -mlarge -MMD -MP -MF"main.d" -MT"main.d" -o"main.o"  "../main.c"
../main.c: In function 'main':
../main.c:13:3: warning: implicit declaration of function 'test_function' [-Wimplicit-function-declaration]
   test_function();
   ^
../main.c: At top level:
../main.c:21:6: warning: conflicting types for 'test_function' [enabled by default]
 void test_function()
      ^
../main.c:13:3: note: previous implicit declaration of 'test_function' was here
   test_function();
   ^
'Finished building: ../main.c'
' '
'Building target: hightest.out'
'Invoking: GNU Linker'
"c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/bin/msp430-elf-gcc.exe" -mmcu=msp430f5438a -Os -g -gstrict-dwarf -Wall -mlarge -Wl,-Map,"hightest.map" -o"hightest.out" "./main.o" -T"../msp430f5438a.ld"  -Wl,--start-group -l"c" -l"gcc" -Wl,--end-group 
'Finished building target: hightest.out'
' '

**** Build Finished ****

 Thanks for your help, spirilis.

I was finally able to compile a "big" program sending some of the code to the FAR_ROM. I had some issues with c libraries (libc.a, libgcc.c and so on), which were being located at .text  section, "overflowing" it.  But I could solve them redefining the .text section to exclude such libraries so they were located to the .far_text section at FAR_ROM.

It is not a definitive solution but it works.

Thanks again for your help...

Share this post


Link to post
Share on other sites

Good Morning,

 

sorry for my question

 

I have just installed CCS v6.0.1.00040 if I use the gcc compiler to compile the "robg-w5500-with-dhcplib" I get the reported error. If instead to use gcc I use the Ti compiler I don't get any error.

 

It seems to be related with the linker script!

 

Please, could you tell me some suggestions  in order to fix the problem ?

 

Thank you very much.

 

Paolo 

 
**** Build of configuration Debug for project eth_gcc ****
 
"c:\\ti\\ccsv6\\utils\\bin\\gmake" -k all 
'Building target: eth_gcc.out'
'Invoking: GNU Linker'
"c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/bin/msp430-elf-gcc.exe" -mmcu=msp430g2553 -Os -g -gstrict-dwarf -Wall -Wl,-Map,"eth_gcc.map" -o"eth_gcc.out" "./dhcplib.o" "./dnslib.o" "./main.o" "./msp430server.o" "./w5500.o" "./wizdebug.o" -T"../msp430g2553.ld"  -Wl,--start-group -l"c" -l"gcc" -Wl,--end-group 
c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/bin/../lib/gcc/msp430-elf/4.8.0/../../../../msp430-elf/bin/ld.exe: eth_gcc.out section `.text' will not fit in region `ROM'
c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/bin/../lib/gcc/msp430-elf/4.8.0/../../../../msp430-elf/bin/ld.exe: section __reset_vector loaded at [0000fffe,0000ffff] overlaps section .text loaded at [0000d038,00010015]
c:/ti/ccsv6/tools/compiler/gcc_msp430_4.8.371/bin/../lib/gcc/msp430-elf/4.8.0/../../../../msp430-elf/bin/ld.exe: region `ROM' overflowed by 130 bytes
collect2.exe: error: ld returned 1 exit status
gmake: *** [eth_gcc.out] Error 1
gmake: Target `all' not remade because of errors.
 
**** Build Finished ****

Share this post


Link to post
Share on other sites

Hm yeah, code too big. Check some of the settings in the CCS project properties- you want the -ffunction-sections parameter turned on in the GCC compiler, along with the --gc-sections option turned on in the Linker. Make sure those are enabled so unused functions get purged from the binary. I haven't tested this codebase with the new GCC yet IIRC.

 

Sent from my Galaxy Note 10.1

Share this post


Link to post
Share on other sites
Thank you very much for the useful advice, 
 
now I am able to build the project without errors, I only get 2 warning messages that seem not to be too important (??). 
 
The bad news is that the code doesn't work. After download and run it, when I push the button (P1.3) the system send the DHCP request but doesn't get success. 
 
The strange thing: on the board, the LED named ACT doesn't blink at all! (the others, SPD, LINK, DUP are on).
 
I have tried to disable the DHCP request commenting out the firsts line of code in order to statically set IP address: still I am not able to ping the board.

 

0) Here it is the DHCP dialog:

 
Beginning:
Waiting for PHY: PHY up
dhcp_loop_configure(): Sending DHCPDISCOVER
dhcp_send_packet(): Our MAC = 00:08:DC:04:03:00
dhcp_loop_configure(): Waiting for DHCPOFFER
dhcp_loop_configure(): RXrecv = 0, virtualRXrecv = 0
dhcp_loop_configure(): RX_RD = 0, RX_WR = 0, TX_RD = 250, TX_WR = 250
dhcp_loop_configure(): Loop count 500 out of 500
dhcp_loop_configure(): TIMEOUT
dhcp_loop_configure returned error: DHCPlib Timeout Waiting for Reply
 

 

 

 

1) The first warning messages :

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

 ../dhcplib.c: In function 'dhcp_send_packet':

../dhcplib.c:251:2: warning: passing argument 3 of 'send' from incompatible pointer type [enabled by default]
  send(sockfd, NULL, (uint16_t *)scratch, 1);  // Submit SEND command to commit the packet over the wire
  ^
In file included from ../dhcplib.h:27:0,
                 from ../dhcplib.c:23:
../w5500.h:181:7: note: expected 'u_int *' but argument is of type 'uint16_t *'
 u_int send(u_char s, const u_char * buffer, u_int * length, u_char retry);
       ^
'Finished building: ../dhcplib.c'
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 

2) The second one :

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

../dnslib.c: In function 'dnslib_gethostbyname':
../dnslib.c:270:2: warning: passing argument 3 of 'send' from incompatible pointer type [enabled by default]
  send(sockfd, NULL, &udp_pkt_len, 1);  // Submit SEND command to commit packet over the wire
  ^
In file included from ../dnslib.c:24:0:
../w5500.h:181:7: note: expected 'u_int *' but argument is of type 'uint16_t *'
 u_int send(u_char s, const u_char * buffer, u_int * length, u_char retry);
       ^
----------------------------------------------------------------------------------------------------------------------------------
 
I have tried to change the casting from ('uint16_t *)  to ( u_int *). The warning messages disappears but the system still hangs.....
 
Strange, when I use the CCS Ti native compiler the same code works fine !!
 
Does both compiler (native Ti and GCC ) coexist on the same CCS installation ?
 
Thank you for your patience !!
 
Paolo

Share this post


Link to post
Share on other sites

Yes the GCC compiler coexists... I haven't tested this code with it yet (just the old mspgcc that never worked with CCS). I wrote the dhcp and dns stuff FYI. Sounds like there's something weird going on there.

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×