Jump to content

Rickta59

Global Moderators
  • Content Count

    1,135
  • Joined

  • Last visited

  • Days Won

    71

Everything posted by Rickta59

  1. @GarryJones @bluehash SPAM SPAM SPAM SPAM
  2. I'm not an OSX person so I'm not familiar with what people use for the msp430. However, this seems to be available for download to program your device: http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430Flasher/latest/index_FDS.html
  3. I did look at the CCS 9 zip download for OSX. It does contain a msp430-elf-gcc. You need to look harder for it. Install CCS and the msp430-elf-gcc and you will have all the command line tools you need.
  4. Sometimes the MSP430-GCC-OPENSOURCE is not exactly the same revision. The msp430f5529 is old in terms of the compiler. It is probably fine for what you are doing. The mspdebug is the opensource programmer I use for msp430 chips. https://github.com/dlbeer/mspdebug For the msp430f5529 launchpad you can use: $ mspdebug tilib 'prog foo.out' CCS also provides a gdb proxy program. I've used it but I find mspdebug more convenient. I can run mspdebug on a raspberry pi, that is never going to happen with CCS. If you have installed dslite that will allow you to upload. Look at how energia uses it. Attached is a simple project I have for the msp430fr6989. You will have to change it for the msp430f5529. $ unzip msp430fr6989.zip $ cd msp430fr6989 $ source env.sh $ make V=1 clean all blink.install msp430fr6989.zip BTW: This zip has a .vscode/c_cpp_properies.json file I use for code indexing. You will have to change it for the msp430f5529
  5. I used the msp430-elf-gcc that is installed in CCS. That makes it more convenient to get updates to both the compiler and the libmsp430.so that you can use with mspdebug tilib. It will save you from having to ping pong back and forth updating the firmware on your msp430f5529 launchpad if you switch between CCS and your VS code setup. I tried to use the gdb client built into VS code. On linux however there is a bug that prevents me from interrupting the execution to pause, so it was useless to me. I setup a makefile target called debug that launches mspdebug in one xterm and msp430-elf-gdb in another xterm. This works well for me. I can use it from vs code or just straight from the command line. I have another makefile target called 'install' that invokes mspdebug tilib 'prog $@' to install the .hex or .elf file into the msp430f5529 flash.
  6. @robertroth your spam is sneaky. @admin you seem to be targeted by spam bots
  7. @HadleyBlues are you a bot?
  8. sneaky spammer bots Eric Emily
  9. You sound like a bot Shivkumar, are you?
  10. This is the change in Oct of 2015 that broke it: https://github.com/energia/Energia/commit/3a79177338cab6e9724144038947db820a70e4b1#diff-ef6c05942e53197e6f1507545468bf55
  11. I see that I mentioned it on this site: April 2016 I even created an issue for was closed but never addressed: https://github.com/energia/Energia/issues/874
  12. It didn't, it has been broken for years and years. It stopped working when 1.6 was released.
  13. So I spent some time with the latest energia 1.8.7E21. It is still using msp430-gcc. That project I linked in the previous post won't work because that code is using the newer msp430-elf-gcc. I did put together an example of using msp430-gcc style code and the blink project above that compiles and create asm only project .. well almost main has to jump to our asm code so there are a couple of instructions to get there. Three files are needed: blink_with_msp430-gcc_asm.ino /* blink_with_msp430-gcc_asm.ino */ /* * we aren't going to use the .ino file */ main.cpp // We override the main function from Energia // and just jump to our __reset_vector__ routine // in blink.S int main() { asm("jmp _reset_vector__"); } blink.S ;------------------------------------------------------------------------------- ; blinkasm.S - gcc compatible interrupt driven led blinker in msp430 asm ; ; Version 1.0 - 10/22/2011 rick@kimballsoftware.com ; Version 1.01 - 7/22/2014 rick@kimballsoftware.com modified for msp430-elf-gcc ; Version 1.02 - 11/02/2014 rick@kimballsoftware.com more changes for msp430-elf-gcc ; $ msp430-elf-gcc blinkasm.S -D_GNU_ASSEMBLER_ -Wall -Os -g \ ; -fdata-sections -ffunction-sections -mmcu=msp430g2553 -T \ ; -T msp430g2553.ld -I/tmp/a/include -L /tmp/a/include/ -nostdlib ; Version 1.03 - 03/16/2019 rick@kimballsoftware.com made compatible with energia ; ;------------------------------------------------------------------------------- .file "blinkasm.S" #include <msp430.h> ;------------------------------------------------------------------------------- ;;; ---- gcc doesn't know about PC,SP,SR,CG1,CG2 ---- #define PC r0 #define SP r1 #define SR r2 ;------------------------------------------------------------------------------- ;;; ---- CONSTANTS ---- //#define TEST_IRQ_OVERHEAD #ifndef TEST_IRQ_OVERHEAD #define _50USEC (50-1) /* @1MHz MCLK results in 50uSec/interrupt */ #define _500MSEC 10000 /* @1MHz MCLK results in 500ms/LED toggle */ #else ;; This test illustrates the minimum CCR0 value that can be used ;; 22 cycles is based on the interrupt overhead #define _50USEC 22 /* @1MHz MCLK results in 23uSec/interrupt */ #define _500MSEC 1 /* @1MHz MCLK results in 23uSec/LED toggle */ #endif #define _LED_PIN BIT6 /* PORT1 pin, Launchpad has BIT0=Red and BIT6=Green */ ;------------------------------------------------------------------------------- ;;; ---- Registers used as globals ---- #define LED_PIN r4 #define TIMER_CYCLES r5 #define INTERVAL_CNT r6 #define CNT r7 ;; or you could use some ram variables .lcomm tcycles,2 ; example use of local bss data variable .lcomm cnt,2 ; example use of local bss data variable ;------------------------------------------------------------------------------- .section .text,"ax",@progbits ;------------------------------------------------------------------------------- .global _reset_vector__ ; it is important to name it "_reset_vector__" ; we prevent the C runtime start code from getting ; linked by using this name _reset_vector__: ;; disable watchdog and set stack to highest RAM addr mov.w #WDTPW|WDTHOLD,&WDTCTL mov.w #__stack,SP ; gcc ldscripts compute __stack based on mmcu ;; initialize clock,gpio,timer init: ;; configure DCO to precalibrated 1MHz clr.b &DCOCTL mov.b &CALBC1_1MHZ,&BCSCTL1 mov.b &CALDCO_1MHZ,&DCOCTL ;; initialize global register values mov.w #_LED_PIN,LED_PIN ; load constant into register constant mov.w #_50USEC,TIMER_CYCLES ; load constant into register constant mov.w #_500MSEC,INTERVAL_CNT ; load constant into register constant mov.w INTERVAL_CNT,CNT ; initialize register based counter ;; initialize GPIO bic.b LED_PIN,&P1OUT ; LED turned off to start bis.b LED_PIN,&P1DIR ; Configure P1.0 as output pin ;; initialize TimerA0 mov.w #CCIE,&TA0CCTL0 ; Enable TA0CCR0 interrupt mov.w TIMER_CYCLES,&TA0CCR0 ; Set TIMER_CYCLES cycles mov.w #TASSEL_2|MC_2,&TACTL ; SMCLK, Continuous Up Mode ;; enable interrupts and loop forever ;; real work done in the CCR0 interrupt nop eint loop: ;; Note: could sleep here instead jmp loop ; cycles:2 ;------------------------------------------------------------------------------- ; TIMER0_A3_ISR - Timer0_A3 CCR0 interrupt handler for vector 0xfff2 ;------------------------------------------------------------------------------- .global __isr_9 ; to insert an interrupt vector into the vector ; table from assembly, we have to use a specific ; naming convention we must call this function ; "__isr_9" this forces it into the 9th vector ; slot counting from 0 starting memory address ; 0xffe0. It is 9 because each vector is ; 2 bytes so we end up in slot 0xfff2 ; all this is because of the way msp430-gcc ; works with interrupts ; .vectors in the msp430g2553/memory.x starts ; @ 0xffe0 ; there are numbered isr_0 ... isr_14 even though ; there are 16 vectors. isr_15 is actually called ; _reset_vector__ you can see how we use it in this ; code. ; see the file: ; http://www.ti.com/lit/ds/symlink/msp430g2553.pdf ; look at the "Interrupt Vector Table" page 11 __isr_9: ;; before we even start running the mcu does a push PC, and a push SR cycles:6 dec.w CNT ; have we looped INTERVAL_CNT times? cycles:1 jnz 1f ; exit if we haven't reached 0 cycles:2 ;; toggle led pin after (INTERVAL * TIMER_CYCLES) has occured xor.b LED_PIN,&P1OUT ; cycles:4 mov.w INTERVAL_CNT,CNT ; reinitialize interval counter cycles:1 1: add.w TIMER_CYCLES,&TA0CCR0 ; set new CCR0 and go again cycles:4 reti ; cycles:5 ; vim: ts=8 sw=8 expandtab: Put those in a new Energia sketch compile it for an msp430g2553 and it should produce output that looks like this: blink_with_msp430-gcc_asm.ino.elf: file format elf32-msp430 Disassembly of section .text: 0000c000 <main>: c000: 03 3c jmp $+8 ;abs 0xc008 c002: 0f 43 clr r15 0000c004 <__ctors_end>: c004: 30 40 5e c0 br #0xc05e 0000c008 <_reset_vector__>: c008: b2 40 80 5a mov #23168, &0x0120 ;#0x5a80 c00c: 20 01 c00e: 31 40 00 04 mov #1024, r1 ;#0x0400 0000c012 <init>: c012: c2 43 56 00 mov.b #0, &0x0056 ;r3 As==00 c016: d2 42 ff 10 mov.b &0x10ff,&0x0057 c01a: 57 00 c01c: d2 42 fe 10 mov.b &0x10fe,&0x0056 c020: 56 00 c022: 34 40 40 00 mov #64, r4 ;#0x0040 c026: 35 40 31 00 mov #49, r5 ;#0x0031 c02a: 36 40 10 27 mov #10000, r6 ;#0x2710 c02e: 07 46 mov r6, r7 c030: c2 c4 21 00 bic.b r4, &0x0021 c034: c2 d4 22 00 bis.b r4, &0x0022 c038: b2 40 10 00 mov #16, &0x0162 ;#0x0010 c03c: 62 01 c03e: 82 45 72 01 mov r5, &0x0172 c042: b2 40 20 02 mov #544, &0x0160 ;#0x0220 c046: 60 01 c048: 03 43 nop c04a: 32 d2 eint 0000c04c <loop>: c04c: ff 3f jmp $+0 ;abs 0xc04c 0000c04e <__isr_9>: c04e: 17 83 dec r7 c050: 03 20 jnz $+8 ;abs 0xc058 c052: c2 e4 21 00 xor.b r4, &0x0021 c056: 07 46 mov r6, r7 c058: 82 55 72 01 add r5, &0x0172 c05c: 00 13 reti 0000c05e <_unexpected_>: c05e: 00 13 reti Disassembly of section .vectors: 0000ffe0 <__ivtbl_16>: ffe0: 04 c0 04 c0 04 c0 04 c0 04 c0 04 c0 04 c0 04 c0 ................ fff0: 04 c0 4e c0 04 c0 04 c0 04 c0 04 c0 04 c0 08 c0 ..N............. To get your SD Card Bootloader running in Energia you would have to replace the blink.S with SDBSL-G2553.S and change your coding style to make msp430-gcc happy. You would also have to replicate all the code that the normal C runtime code does to create an environment for a C++ application. Basically you have to setup the .data section (copying the initial values from flash to ram), initialize the .bss section all to zero, loop through all the global c++ constructors, then call the users main function. blink_with_msp430_asm.zip
  14. Interesting stuff. Here are some things that seem like they might cause you issues: Rewriting in C++ can be small. Using the Energia API will defeat that and not result in a 1k sd card bootloader. Cross Platform issues, Energia supports Windows, OS/X, and Linux. You need to supply the binaries for all the tools you are using that run on all platforms. It is easiest to stick with the gcc object tools for manipulating the .hex file. Naken asm source - No one has that so you either provide the naken assembler binary. Alternatively, if you want to just go with assembler + Energia, you might rewrite your asm code so that it is compatible with msp430-gcc assembly. I think Energia still takes .S files (gcc assembler source) The biggest difference between naken and gcc is having an external linker script for the symbol addresses you have hard coded in the .m43 source code. You are facing the same kinds of issues I bumped up against doing a small GDB bootloader. However, I was trying to avoid being part of the user code or changing the way Energia sets up the linker scripts. I'm not sure you can overcome that without getting into the details of the vector table and the linker script. You might find this useful: https://gist.github.com/RickKimball/ead0b3b0f28f0dbf426c51f46ced59ab
  15. not json but instructions given for linux https://github.com/RickKimball/tivac-core Assumes you have openocd and arm-none-eabi-gcc in your path. Probably won't work for windows. Probably will work for OSX.
  16. The msp430g2231 only has a total of 2048 bytes of flash. If you use Energia, you are going to suck up half that flash just getting it to compile an empty sketch. The EEPROM on an atmega328p has 1024 bytes of eeprom. What do you want to store in EEPROM?
  17. this was fixed a long time ago. https://github.com/robertinant/EnergiaNG/issues/10 are you sure you have the latest stuff?
  18. Do you want people to help you with this? It seems like you are expecting people to fill in the gaps. Should I just delete the repo?
  19. I uploaded the zip file that is available from sourceforge. You pointed me at that. If I'm going to upload something to source control, I'm going to base it on a source code control system instead of a forum post that is likely to disappear. No I don't think it is presumptous. I really don't claim to have written it. The readme doesn't say anything about me being the author. The README.md indicates it is a mirror of your original. It also has all your contact information not mine. I would much prefer that you have a repository that I could fork and provide changes via a pull requests instead of dealing with zip files. Zip files are not a source code control system.
  20. I created a mirror of your source code on github. I extracted all the files so people can look at it without downloading a zip file. I also created a msp430 branch that shows the changes I needed to make to get simple blinky and super blinky to compiler for the msp430. https://github.com/RickKimball/CoRTOS/tree/msp430 -rick
  21. Thanks I hadn't found that in my searches. Do you plan on doing any msp430 specific features?
  22. Sure I understand that. I'm just passing along my biased observations What I've seen with the msp430 and RTOS support in general is this. People/groups make a simplistic stab at supporting the msp430 and then just as quickly abandon the effort. It is hard to compete with the fully featured TI-RTOS/SYS-BIOS code. TI-RTOS is free with a BSD license. TI actually supports it on their e2e.ti.com forum. However, it is a beast. TI-RTOS tames you, you don't tame it. I've heard it is slow and bloated on the msp430. It uses an arcane set of TI custom command line based tools that force you to conform. I don't want to be tamed. In my opinion, TI is good with hardware and software is an afterthought that some marketing guy needs to be able to check boxes on a specification sheet. I think there is a niche for a small and simple RTOS, not unlike what you have posted, that actually fully takes advantage of the lower power features of the msp430 chips. However, it would be easier to pass on fixes and identify real software issues if you put the source code on some public repository. That is assuming your goal is to get a group of people actively using the code. It might eliminate the muttering of 100 people making the same fix in some snapshot in time of a zip file you randomly post on various web forums. Other users here have posted some simple tasking code. However, there is always some catch or no followup. This guy posted some promising code. Sadly it was writtten to work only with the $1500 IAR compiler and after he posted it there wasn't any follow up. FreeRTOS supposedly works on the msp430 chips. So don't think I'm discouraging your efforts. I applaud it. Seems like a good first start. If you want feedback, I'll provide it.
  23. I'm not actually not a moderator any more .. not sure why it is still attached to my userid. @bluehash ?
×
×
  • Create New...