This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am trying to create a project with assembly code only (absolutely no C code) in code composer studio (Version: 5.5.0.00077) and I am having difficulty in doing it.
In New CCS Project there is an option to create “Empty Assembly-only project”, if I use this option,
In Advanced settings, there is an option for Compiler version,
Since the start up code is also assembly, why do I need to have compiler option for assembly only project?
Why does it create a code template in C if the project option is Assembly-only project?
I referred to few threads on this topic but could not get any answer for above questions.
https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/135041
On Sep 18, 2011 6:02 PM , it says “This was a known issue with earlier v5 builds (SDSCM00040000) but it should be fixed in the latest v5.1 builds.”
I hope my version Version: 5.5.0.00077 has fix for this??
My error and problem is same as in below thread:
https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/235407
I did not find solution but on Dec 27, 2012 6:26 PM, it says “Most users begin with C programs, and the out of box templates and examples are set up to work better with C projects rather than assembly only projects”
I have come across many C code examples and projects but I am looking for assembly code projects:
Are there any example codes for assembly only? Or
How to create a project for Assembly language only?
Regards
Srinivasa
Srinivasa Wunnimani said:In New CCS Project there is an option to create “Empty Assembly-only project”, if I use this option,
In Advanced settings, there is an option for Compiler version,
Since the start up code is also assembly, why do I need to have compiler option for assembly only project?
I am not sure what exactly you are referring to but a Compiler toolset is required to build assembly only programs as well, hence the need for a Compiler version. The Compiler shell in turn invokes the assembler to build assembly only programs.
Srinivasa Wunnimani said:Why does it create a code template in C if the project option is Assembly-only project?
Please show exactly what code template in C is being created.
Srinivasa Wunnimani said:My error and problem is same as in below thread:
Did the solution provided in the other thread not help in your case?
Srinivasa Wunnimani said:Are there any example codes for assembly only?
Which target processor are you working with? There are assembly code examples for MSP430 included with MSPWare, but there aren't really any examples for other processor families.
Question 1:
TI: I am not sure what exactly you are referring to but a Compiler toolset is required to build assembly only programs as well, hence the need for a Compiler version. The Compiler shell in turn invokes the assembler to build assembly only programs.
Srinivas: My understanding was that compiler will be required only If I use high level language programming (to convert high level to assembly language). In our case we are trying to create a project in assembly so we can avoid compiler and we can directly invoke assembler to generate object file. In fact in the CCSV5 installation folder “C:\ti\ccsv5\tools\compiler\arm_5.1.11\bin” we have an assembler armasm.exe. I was able to generate an object file at command line using the command “armasm.exe hello.asm hello.o” but I had a problem of downloading and running it.
Compiler toolset contains compiler, assembler, and linker build together. I just thought we can avoid compiler by invoking the assembler directly, anyway this is not of big concern; we can go ahead having compiler option.
Question 2:
TI: Please show exactly what code template in C is being created.
Srinivas: Please find the c file attached (file name : Copy_of_tm4c129encpdt_startup_ccs.c).
TI: Did the solution provided in the other thread not help in your case?
Srinivas: I just added a new file “hello.asm” and build it. Now there are no errors and object file is being generated. I am not sure what did I miss in the earlier case. Sorry for that.
I have few other questions on the new object file generated:
The new object file generated is 22,372 bytes but the code I have written is barely 3 lines of assembly.
Does the new object file generated includes any startup code? I am seeing SP and PC are not loaded with proper values so it is not working as expected.
If you can provide me some example projects (as discussed below in Question 3), it might answer my questions.
Question 3:
TI: Which target processor are you working with? There are assembly code examples for MSP430 included with MSPWare, but there aren't really any examples for other processor families.
I am working on TIVA tm4c129encpdt processor. If there are any examples for this, let me know.
Regards
Srinivasa
//***************************************************************************** // // Startup code for use with TI's Code Composer Studio. // // Copyright (c) 2011-2013 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // //***************************************************************************** #include <stdint.h> //***************************************************************************** // // Forward declaration of the default fault handlers. // //***************************************************************************** void ResetISR(void); static void NmiSR(void); static void FaultISR(void); static void IntDefaultHandler(void); //***************************************************************************** // // External declaration for the reset handler that is to be called when the // processor is started // //***************************************************************************** extern void _c_int00(void); //***************************************************************************** // // Linker variable that marks the top of the stack. // //***************************************************************************** extern uint32_t __STACK_TOP; //***************************************************************************** // // External declarations for the interrupt handlers used by the application. // //***************************************************************************** // To be added by user //***************************************************************************** // // The vector table. Note that the proper constructs must be placed on this to // ensure that it ends up at physical address 0x0000.0000 or at the start of // the program if located at a start address other than 0. // //***************************************************************************** #pragma DATA_SECTION(g_pfnVectors, ".intvecs") void (* const g_pfnVectors[])(void) = { (void (*)(void))((uint32_t)&__STACK_TOP), // The initial stack pointer ResetISR, // The reset handler NmiSR, // The NMI handler FaultISR, // The hard fault handler IntDefaultHandler, // The MPU fault handler IntDefaultHandler, // The bus fault handler IntDefaultHandler, // The usage fault handler 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // SVCall handler IntDefaultHandler, // Debug monitor handler 0, // Reserved IntDefaultHandler, // The PendSV handler IntDefaultHandler, // The SysTick handler IntDefaultHandler, // GPIO Port A IntDefaultHandler, // GPIO Port B IntDefaultHandler, // GPIO Port C IntDefaultHandler, // GPIO Port D IntDefaultHandler, // GPIO Port E IntDefaultHandler, // UART0 Rx and Tx IntDefaultHandler, // UART1 Rx and Tx IntDefaultHandler, // SSI0 Rx and Tx IntDefaultHandler, // I2C0 Master and Slave IntDefaultHandler, // PWM Fault IntDefaultHandler, // PWM Generator 0 IntDefaultHandler, // PWM Generator 1 IntDefaultHandler, // PWM Generator 2 IntDefaultHandler, // Quadrature Encoder 0 IntDefaultHandler, // ADC Sequence 0 IntDefaultHandler, // ADC Sequence 1 IntDefaultHandler, // ADC Sequence 2 IntDefaultHandler, // ADC Sequence 3 IntDefaultHandler, // Watchdog timer IntDefaultHandler, // Timer 0 subtimer A IntDefaultHandler, // Timer 0 subtimer B IntDefaultHandler, // Timer 1 subtimer A IntDefaultHandler, // Timer 1 subtimer B IntDefaultHandler, // Timer 2 subtimer A IntDefaultHandler, // Timer 2 subtimer B IntDefaultHandler, // Analog Comparator 0 IntDefaultHandler, // Analog Comparator 1 IntDefaultHandler, // Analog Comparator 2 IntDefaultHandler, // System Control (PLL, OSC, BO) IntDefaultHandler, // FLASH Control IntDefaultHandler, // GPIO Port F IntDefaultHandler, // GPIO Port G IntDefaultHandler, // GPIO Port H IntDefaultHandler, // UART2 Rx and Tx IntDefaultHandler, // SSI1 Rx and Tx IntDefaultHandler, // Timer 3 subtimer A IntDefaultHandler, // Timer 3 subtimer B IntDefaultHandler, // I2C1 Master and Slave IntDefaultHandler, // CAN0 IntDefaultHandler, // CAN1 IntDefaultHandler, // Ethernet IntDefaultHandler, // Hibernate IntDefaultHandler, // USB0 IntDefaultHandler, // PWM Generator 3 IntDefaultHandler, // uDMA Software Transfer IntDefaultHandler, // uDMA Error IntDefaultHandler, // ADC1 Sequence 0 IntDefaultHandler, // ADC1 Sequence 1 IntDefaultHandler, // ADC1 Sequence 2 IntDefaultHandler, // ADC1 Sequence 3 IntDefaultHandler, // External Bus Interface 0 IntDefaultHandler, // GPIO Port J IntDefaultHandler, // GPIO Port K IntDefaultHandler, // GPIO Port L IntDefaultHandler, // SSI2 Rx and Tx IntDefaultHandler, // SSI3 Rx and Tx IntDefaultHandler, // UART3 Rx and Tx IntDefaultHandler, // UART4 Rx and Tx IntDefaultHandler, // UART5 Rx and Tx IntDefaultHandler, // UART6 Rx and Tx IntDefaultHandler, // UART7 Rx and Tx IntDefaultHandler, // I2C2 Master and Slave IntDefaultHandler, // I2C3 Master and Slave IntDefaultHandler, // Timer 4 subtimer A IntDefaultHandler, // Timer 4 subtimer B IntDefaultHandler, // Timer 5 subtimer A IntDefaultHandler, // Timer 5 subtimer B IntDefaultHandler, // FPU 0, // Reserved 0, // Reserved IntDefaultHandler, // I2C4 Master and Slave IntDefaultHandler, // I2C5 Master and Slave IntDefaultHandler, // GPIO Port M IntDefaultHandler, // GPIO Port N 0, // Reserved IntDefaultHandler, // Tamper IntDefaultHandler, // GPIO Port P (Summary or P0) IntDefaultHandler, // GPIO Port P1 IntDefaultHandler, // GPIO Port P2 IntDefaultHandler, // GPIO Port P3 IntDefaultHandler, // GPIO Port P4 IntDefaultHandler, // GPIO Port P5 IntDefaultHandler, // GPIO Port P6 IntDefaultHandler, // GPIO Port P7 IntDefaultHandler, // GPIO Port Q (Summary or Q0) IntDefaultHandler, // GPIO Port Q1 IntDefaultHandler, // GPIO Port Q2 IntDefaultHandler, // GPIO Port Q3 IntDefaultHandler, // GPIO Port Q4 IntDefaultHandler, // GPIO Port Q5 IntDefaultHandler, // GPIO Port Q6 IntDefaultHandler, // GPIO Port Q7 IntDefaultHandler, // GPIO Port R IntDefaultHandler, // GPIO Port S IntDefaultHandler, // SHA/MD5 0 IntDefaultHandler, // AES 0 IntDefaultHandler, // DES3DES 0 IntDefaultHandler, // LCD Controller 0 IntDefaultHandler, // Timer 6 subtimer A IntDefaultHandler, // Timer 6 subtimer B IntDefaultHandler, // Timer 7 subtimer A IntDefaultHandler, // Timer 7 subtimer B IntDefaultHandler, // I2C6 Master and Slave IntDefaultHandler, // I2C7 Master and Slave IntDefaultHandler, // HIM Scan Matrix Keyboard 0 IntDefaultHandler, // One Wire 0 IntDefaultHandler, // HIM PS/2 0 IntDefaultHandler, // HIM LED Sequencer 0 IntDefaultHandler, // HIM Consumer IR 0 IntDefaultHandler, // I2C8 Master and Slave IntDefaultHandler, // I2C9 Master and Slave IntDefaultHandler, // GPIO Port T IntDefaultHandler, // Fan 1 0, // Reserved }; //***************************************************************************** // // This is the code that gets called when the processor first starts execution // following a reset event. Only the absolutely necessary set is performed, // after which the application supplied entry() routine is called. Any fancy // actions (such as making decisions based on the reset cause register, and // resetting the bits in that register) are left solely in the hands of the // application. // //***************************************************************************** void ResetISR(void) { // // Jump to the CCS C initialization routine. This will enable the // floating-point unit as well, so that does not need to be done here. // __asm(" .global _c_int00\n" " b.w _c_int00"); } //***************************************************************************** // // This is the code that gets called when the processor receives a NMI. This // simply enters an infinite loop, preserving the system state for examination // by a debugger. // //***************************************************************************** static void NmiSR(void) { // // Enter an infinite loop. // while(1) { } } //***************************************************************************** // // This is the code that gets called when the processor receives a fault // interrupt. This simply enters an infinite loop, preserving the system state // for examination by a debugger. // //***************************************************************************** static void FaultISR(void) { // // Enter an infinite loop. // while(1) { } } //***************************************************************************** // // This is the code that gets called when the processor receives an unexpected // interrupt. This simply enters an infinite loop, preserving the system state // for examination by a debugger. // //***************************************************************************** static void IntDefaultHandler(void) { // // Go into an infinite loop. // while(1) { } }
Srinivasa Wunnimani said:In fact in the CCSV5 installation folder “C:\ti\ccsv5\tools\compiler\arm_5.1.11\bin” we have an assembler armasm.exe. I was able to generate an object file at command line using the command “armasm.exe hello.asm hello.o” but I had a problem of downloading and running it.
Yes, you can invoke armasm directly on command line, however the recommended method is to invoke the shell armcl, which in turn will invoke the assembler under the hood when the source file passed to it is an assembly source file.
Srinivasa Wunnimani said:Please find the c file attached (file name : Copy_of_tm4c129encpdt_startup_ccs.c).
Yes, I see that this file gets added to the project. This should ideally not be the case for an assembly only project. As you have seen, the startup file sets up the stack and vector table etc, and we add this file to new Tiva CCS projects as a way to ease the project creation/build process for the user so they have a template to start with. If you wish to have a pure assembly program with no C source files then you can exclude this file from the build and you would need to take care of all the startup requirements in the assembly code.
Srinivasa Wunnimani said:I am working on TIVA tm4c129encpdt processor. If there are any examples for this, let me know.
I am not aware of any assembly-only examples for this processor.
Are there any project examples with combination of assembly code and C language for this processor family?
The reference software provided by TI for this processor family is TivaWare: http://www.ti.com/tool/sw-tm4c. This includes libraries and examples written in C.
I am not aware of any examples with combination of assembly and C code for this family.