* TSX shed 0.6 pct for the week; up 3.7 pct for the quarter * Nine of 10 main sectors higher; financials down 0.2 pct * RIM shares gain on shake-up hopes By Jennifer Kwan TORONTO, March 30 (Reuters) - Toronto's main stock index ended on a positive note on Friday after falling for three straight sessions, led by firm commodity prices as the resource-heavy market notched its best quarterly gain in a year. The market's key pillars of materials and energy, representing some 40 percent of the broader index, led the way higher in tandem with U.S. equities that were buoyed by reassuring U.S. consumer spending and sentiment data. Big names on the upside included Potash Corp, up 1.3 percent at C$45.54, and Goldcorp, which gained 1.5 percent at C$44.96. Canadian Natural Resources climbed 1.9 percent to C$33.06. Oil, gold and base metals were all firmer, supporting moves higher in resource shares. GOL/] "We're certainly seeing buying on the dips. That's quite obvious from the fact that the two of the better sector performers today were energy and materials, and those sectors have been among the worst performers over the quarter," said Elvis Picardo, strategist at Global Securities in Vancouver. The Toronto Stock Exchange's S&P/TSX composite index ended the day up 52.82 points, or 0.43 percent, at 12,392.18, with most of its 10 main sectors higher. Earlier, it rose to a high of 12,433.31. The index shed 0.6 percent for the week, but gained 3.7 percent for the quarter, its best quarterly performance since March 2011. Research in Motion was among the most heavily traded stocks, and its shares climbed 6.9 percent to C$14.63, as investors were heartened by a shake-up at the company, market strategists said. A candid diagnosis of the troubles facing the BlackBerry maker delivered by new Chief Executive Thorsten Heins was a welcome change for its stakeholders, but his prescription for returning the company to health might be hard to swallow. Former co-CEO Jim Balsillie stepped down as director, part of a shake-up of the company's senior ranks by its new chief executive. "(RIM's) been beaten up pretty badly so I would think that maybe the market likes the resignations and is hoping somebody will come in with a new brush and clean up the mess," said John Kinsey, portfolio manager at Caldwell Securities. RIM recorded its first quarterly loss in seven years on Thursday and said it would no longer issue financial forecasts. A prolonged slump in sales of its smartphones shows no signs of abating, it said, at least until it can launch its next-generation line-up later this year.